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

Home » Public Forums » archive » Re: Container/Holder Destruction
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: Container/Holder Destruction [message #45617 is a reply to message #45616] Mon, 19 September 2005 04:22 Go to previous message
Antonio Santiago is currently offline  Antonio Santiago
Messages: 201
Registered: February 2004
Senior Member
IDLmastertobe wrote:
> Hi, I am objects in my code and trying to destroy them after using to avoid
> memory leaks. I have created many objects and to destroy them, I created
> another holder object using IDLgrContainer, I am just wondering if I
> destroy this holder object, would all the objects I added into this holder
> object be destroyed as well? or I need to destroy everything one by one?
> Thanks.
>

Your question has a simple response, make a test:

PRO test

o1 = OBJ_NEW('IDLgrImage')
o2 = OBJ_NEW('IDLgrImage')
o3 = OBJ_NEW('IDLgrImage')
o4 = OBJ_NEW('IDLgrImage')

c = OBJ_NEW('IDL_Container')
c->Add, [o1, o2, o3, o4]

print, 'Num object = ',c->Count()
HELP, /HEAP

OBJ_DESTROY, c
print, 'Container destroyed'
HELP, /HEAP
END


When you destroys an IDL_Container it executes the 'cleanup' method of
the holded objects.

Some is interesting destroy the container but not the objects inside it
(because another object has the same reference). Then is needes execute:

c->Remove, /ALL
OBJ_DESTROY, c


Bye.

PD: Take a look at my web page (this is not spam :) ) i have some litlle
clases for IDL that can simplify the OO programer life in IDL.

--
-----------------------------------------------------
Antonio Santiago P�rez
( email: santiago<<at>>grahi.upc.edu )
( www: http://www.grahi.upc.edu/santiago )
( www: http://asantiago.blogsite.org )
-----------------------------------------------------
GRAHI - Grup de Recerca Aplicada en Hidrometeorologia
Universitat Polit�cnica de Catalunya
-----------------------------------------------------
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Help me plz abt this c program
Next Topic: Re: FILE_DIRNAME question

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

Current Time: Sun Oct 12 08:02:16 PDT 2025

Total time taken to generate the page: 1.04232 seconds