Yet another object graphics question [message #42791] |
Wed, 23 February 2005 23:54 |
Michael Wallace
Messages: 409 Registered: December 2003
|
Senior Member |
|
|
Say that you want to write a utility function which will create a basic
plot. Let's say this function returned an IDLgrModel with some
IDLgrPlots on the the inside and various axes and the like. Because all
of the objects are in a single tree, destroying them is a snap -- just
destroy the top level object and the destruction cascades down.
Now what do you do if you want to create an IDLgrFont or other "helper"
object inside the utility function? You can't destroy the helper
because you'll get an invalid object reference where it had been used
and once you fall out of the function, you won't have a named variable
reference to the helper object. The helper will still be present on the
heap, but there isn't any name to pass obj_destroy. Once I finish using
the IDLgrModel returned from the function, I can destroy it, but the
helpers are left dangling.
Is there any rule of thumb ya'll follow for cases like this? I don't
want to have heap_gc commands in my code just to clean up after myself. :-)
-Mike
|
|
|