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

Home » Public Forums » archive » 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
IDL_Container and garbage collection [message #72112] Sun, 08 August 2010 00:16
Robbie is currently offline  Robbie
Messages: 165
Registered: February 2006
Senior Member
Hi,

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.

Robbie
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: iTools problem with setting isotropic in 8.0
Next Topic: svdfit-measure_errors

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

Current Time: Wed Oct 08 15:26:32 PDT 2025

Total time taken to generate the page: 0.00469 seconds