Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
RemoveObject and Release
Message
From
14/07/1999 22:53:19
Stephen Bridgett
Stephen Bridgett Consulting
Gloucester, Ontario, Canada
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Title:
RemoveObject and Release
Miscellaneous
Thread ID:
00241632
Message ID:
00241632
Views:
60
Can someone shed some light on this issue. Its a bit convoluted so hang on.

Say I have a custom object and I add other objects to it (addobject).

For each object I add, if it is a container type object (custom, container, grid, form ...) then, in the init event of that object being added to the original custom object, I used createobject to create a separate custom object. Wait theres more. When I create that object (createobject not addobject) it passes it a reference to itself (the creating object) which the created object stores in a property within itself.

The links between the the two objects, (the first creates the second) is then bi-directional (like a double linked list).

So we have a custom object using addobject (has-a) and each container added creates a custom object (uses) which stores a back link.

Now if you can picture this, the questions are the following:

1. If I use RemoveObject in the outside parent container and remove the contained objects, is the memory freed up. In other words, does Fox do the garbage collection on the CREATE(D)OBJECTS.

2. Do I have to break the backlinks before I can release objects.

3. What is the essential difference between RemoveObject and Release.

This is a thorny issue. If you play with this stuff it quickly yields inconclusive results. Except of course, if you do break rules, eventually the app crashes.

Any knowledge on this appreciated.
Stephen Bridgett
Hand Crafted Relational Database Solutions
Focusing on Visual Foxpro and Object Oriented Design
SBridgett@cyberus.ca
Next
Reply
Map
View

Click here to load this message in the networking platform