Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
The object itself
Message
From
28/05/2007 15:52:26
 
 
To
28/05/2007 15:28:30
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Environment versions
Visual FoxPro:
VFP 6 SP5
Miscellaneous
Thread ID:
01228871
Message ID:
01228913
Views:
19
Yes, you're right Sylvain. Good catch. I'll have to see if I can figure a way around the issue.

>Beware with this method since I doubt that the GC of VFP will clean up the class when it is released because of the circular reference. I've done a quick test and you can see that the memory is not released:
clear
>CLEAR all
>? SYS(1016)
>
>abc = NEWOBJECT("testme")
>abc = null
>? SYS(1016)
>
>abc = NEWOBJECT("testme")
>abc = null
>? SYS(1016)
>
>abc = NEWOBJECT("testme")
>abc = null
>? SYS(1016)
>
>CLEAR all
>? SYS(1016)
>
>DEFINE CLASS testme as Custom
>
>PROCEDURE init
>	this.addproperty ("self", this)
>ENDPROC
>
>ENDDEFINE
Put the Init of the class in comments and run the test again. You'll see that the memory is now cleared.
>
>>I don't know of a way innate to VFP, but in the init, I like to add a property called self to my objects.
>>
>>This.AddProperty('Self', This)
>>
>>Then, of course, it's easy to send .self as a parameter withing a with...endwith.
Previous
Reply
Map
View

Click here to load this message in the networking platform