Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado
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 -----------------------------------------------------
Thanks for the reply. I check my heap and found no memory leak in the heap. I am trying to visualize 3D data and the cleanup won't be called until the graphic window is closed. When I was working with a 3D data with dimension 52x52x52, the program works fine. When I used data with dimension 257x257x257, the memory runs out BEFORE the 3D image appeared. In this case, I can't see how memory leak will affect me since the cleanup won't be called until I finish visualing and close the 3D graphic window, which does not even appear right now. I am using a lot of objects and saving many of them in a state structure. I think the size of the objects are building up pretty quickly and eating up my RAM. Am I missing some important information on where I am wasting my memory? Does anyone have any suggestion on how I can "save" some memory? I cannot destroy any object BEFORE i close the 3D graphic window because the object information is needed for the 3D graphics. But if I don't destroy some of them, I don't think there is enough RAM for the graphics in my case right now. Thanks for your help. I appreciate your time.
IDLmastertobe wrote: > Thanks for the reply. > > I check my heap and found no memory leak in the heap. I am trying to > visualize 3D data and the cleanup won't be called until the graphic window > is closed. When I was working with a 3D data with dimension 52x52x52, the > program works fine. When I used data with dimension 257x257x257, the > memory runs out BEFORE the 3D image appeared. In this case, I can't see > how memory leak will affect me since the cleanup won't be called until I > finish visualing and close the 3D graphic window, which does not even > appear right now. I am using a lot of objects and saving many of them in > a state structure. I think the size of the objects are building up pretty > quickly and eating up my RAM. Am I missing some important information on > where I am wasting my memory? Does anyone have any suggestion on how I > can "save" some memory? I cannot destroy any object BEFORE i close the 3D > graphic window because the object information is needed for the 3D > graphics. But if I don't destroy some of them, I don't think there is > enough RAM for the graphics in my case right now. Thanks for your help. > I appreciate your time. > I dont know what your problem is but I have worked with objects and object graphics with data bigger than 257x257x257 and there is no problem. Perhaps you have problems in functions that creates your objects or graphic object and creates many times the same objects. -- ----------------------------------------------------- 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 -----------------------------------------------------
hi, i am still pretty confused on which object is taking up all my RAM. I have 1GB of installed RAM. When I worked with the smaller file with dimension 52x52x52, i found it created about 50 objects to visualize. When I worked on the larger file with 257x257x257, it created 47 objects. But the large file ate up all the RAM before it even appeared. I am just wondering if there is any call or procedure that enable me to find out which object or array,etc is taking up all my RAM. Is there such a function? with detailed memory usage of its component? anyone has any suggestion on how I can discover the culprit? Thanks