Are you using a debugger to verify that the reference count reaches zero? If you have another ref_ptr referencing the top-level node, the reference count will not drop to zero and memory won't be freed. How are you inferring that memory isn't freed? Some operating systems only free memory back to the process rather than back to the OS, so the process size remains the same (it includes the size of freed memory, which is available for reallocation). -Paul
_____ From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of C C Sent: Monday, November 05, 2007 2:17 PM To: [email protected] Subject: [osg-users] removeChild not freeing memory Hi all, This is a total noob question, but I must assume that I'm either doing something incorrectly or misunderstanding how removeChild works. I have a program that is loading/unloading model *.osg files on the fly. When I do a removeChild on the model's node, no memory seems to be released. Thus as I load/unload more models the memory used goes up, which will eventually lead to a crash. Just to try this on a simple scale, I went to the osgshadowtexture example since I knew that a readNodeFile call was made to load cessna.osg, and made some small modifications. In the main loop of the program I wait for about 500 iterations after the readNodeFile call, and then I remove all of the children from the node called "model" in the program. This obviously succeeds because if I continue running the example the default blue shows with all models removed. Unfortunately, no memory gets freed. Shouldn't the memory used go down after that though? Even if I wait for multiple iterations after the removal the memory used does not go down. Is there something blatantly wrong with what I'm doing? If so could you tell me what I need to do in order to free the memory that was taken up by the loading of the cessna.osg? Thanks in advance. -CC
_______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

