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

Home » Public Forums » archive » Re: object reference destroy
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: object reference destroy [message #67103 is a reply to message #67051] Mon, 22 June 2009 09:30 Go to previous messageGo to previous message
Doug Edmundson is currently offline  Doug Edmundson
Messages: 58
Registered: November 2005
Member
Hi crane,

The get() method returns a reference to the stored object - not some
kind of copy of the original. So when you delete the gotten object, the
original is destroyed.

You can eat as much of your cake as you want, just don't throw it away
until you really don't want the cake any more. ;-)

Hope this helps,
Doug

crane wrote:
> 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.
>
>
>
>
>
>
>
>
>
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: IDL 7.1.1 Workbench update for Macintosh OS X
Next Topic: Re: AT&T Usenet Netnews Service Shutting Down

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

Current Time: Sat Oct 11 00:31:29 PDT 2025

Total time taken to generate the page: 0.07961 seconds