Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Memory leaks?
Message
 
 
To
31/10/1998 13:38:51
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Title:
Miscellaneous
Thread ID:
00148261
Message ID:
00153211
Views:
26
Rick,

SYS(1016) isn't always a reliable measurement tool. And VFP will reuse memory from the pool. If you run this program, it creates a "huge" object, destroys and creates it again. The second time doesn't cause a doubling of memory use:

clear all
activate window "debug output"

debugout "main pre createobject " + sys(1016)
createobject( "cForm" )
debugout "main post createobject " + sys(1016)

debugout "main pre createobject " + sys(1016)
x = createobject( "cForm" )
debugout "main x exists " + sys(1016)
release x
debugout "main post release " + sys(1016)

define class cForm as Form

procedure Init
this.Tag = replicate( "abcde", 100000 )
this.Visible = .t.
debugout program() + " " + sys(1016)
endproc

procedure Destroy
debugout program() + " " + sys(1016)
endproc

enddefine


>At first I thought I did. But the "experiment" I tried was from the command window. I simply created an object, and then either removed the object, released the object, or set the object reference to null. In each case SYS(1016) reported a significant reduction in available memory.
>
>In the end, I have "solved" the problem by not dynamically creating and releasing objects in my application. Instead, at startup I create all of the object instances I need and simply "recycle" them. I don't think this was the intent of MS, however. BTW you're right about my misuse of the term "memory leak" since the memory is recovered when my VFP app is exited.
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Previous
Reply
Map
View

Click here to load this message in the networking platform