comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: IDL_Container and garbage collection
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: IDL_Container and garbage collection [message #72107] Mon, 09 August 2010 09:43
Michael Galloy is currently offline  Michael Galloy
Messages: 1114
Registered: April 2006
Senior Member
On 8/8/10 1:16 AM, Robbie wrote:
> I've just found an interesting problem with migrating from IDL 7 to
> IDL 8. When an IDL_Container is cleaned up and then all of its
> children are automatically deleted. This means that the reference
> count hits zero and all children are also destroyed.
>
> Example code below:
>
> function obj_create_child
> oParent = obj_new('IDL_Container')
> oChild = obj_new('IDL_Container')
> oParent -> Add, oChild
> help, oChild ; Child Object has not been destroyed yet
> ;;;; oParent -> remove, /ALL ; Workaround - Remove all children before
> garbage collection
> ;;;; obj_destroy, oParent ;;; Pedantic - Destroy the empty heap object
> return, oChild
> end
>
> pro obj_create
> help, obj_create_child() ; Child object is destroyed before it is
> returned because oParent is garbage collected
> end
>
> In many ways the above snippet of code is sloppy because it would
> leave the parent object on heap. Code that performed correct garbage
> collection in IDL 7 should not be affected by this issue.

Yes, I suppose the lesson is that if your pre IDL 8.0 code does not leak
memory already, then it should be fine. If your code does leak memory,
it wont leak memory in IDL 8.0 but it has the potential to not work
correctly anymore.

Mike
--
www.michaelgalloy.com
Research Mathematician
Tech-X Corporation
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Floating-point accuracy problem
Next Topic: Re: Draw Widget Object Graphics Scrolling, Confused

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 15:57:50 PDT 2025

Total time taken to generate the page: 0.00589 seconds