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

Home » Public Forums » archive » object reference destroy
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
object reference destroy [message #67110] Mon, 22 June 2009 02:53
dosfun is currently offline  dosfun
Messages: 14
Registered: February 2009
Junior Member
hi, people

I have a container to hold a object, and I need to use this object
often. In order to avoid memory leakage, i have to destroy the object
reference after use. But once i destroy the object reference, the
object in the container is also destroy, because they are pointing to
the same object. For example:

; put a object into the container
container = obj_new('idl_container')
obj = obj_new('myclass')
container->add, obj

; get the object for the first time
objref _1= container->get(/all)
....
; destroy the object reference for the first time. (memory reason)
obj_destroy, objref_1

; need to get the object from the container second time
objref_2= container->get(/all)
; but objref_2 is not a valid object anymore, because i destroy the
object in the previous section.
IDL> print, obj_valid(objref_2)
0


I like to use container to hold object, it is convenience to play with
objects. can somebody help me through this problem or have another
idea for alternative. thanks.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Extended dilaog_pickfile
Next Topic: unix/idl question

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

Current Time: Wed Oct 08 13:36:44 PDT 2025

Total time taken to generate the page: 0.00841 seconds