Question about the object lifecycle [message #68658] |
Sat, 07 November 2009 14:22 |
M. Katz
Messages: 69 Registered: May 2005
|
Member |
|
|
Within complex graphic objects, I often add objects to a main model
like this
self.oModel = obj_new('IDLgrModel')
self.oModel -> Add, obj_new('IDLgrPolygon', . . .)
I don't keep an explicit reference to the IDLgrPolygon object in this
case because I don't need it.
My question is: What happens to the IDLgrPolygon once I destroy the
parent object? My Cleanup method explicity destroys the self.oModel.
So what becomes of the orphaned IDLgrPolygon? Will it go into heap
limbo and ultimately be recycled? Or will it take up space until the
IDL session is reset? I can see from a quick test using HELP that once
the IDLgrModel is destroyed, the reference to the child object becomes
<ObjHeapVar2>, like that.
As a best-practice, should I be keeping the references to every object
I create in this way, so I can explicitly destroy them in the Cleanup
method?
Thanks,
M.
|
|
|