Yeah I verified through the debugger that the reference count reaches 0.

However you may be correct about the memory release...all I've been using to
check that is the "Memory Used" column of the task manager that Windows XP
provides.  The main reason that I thought the memory was not being freed was
that in my program whenever I loaded and unloaded you could see small
amounts of memory being released from iteration to iteration based off of
some other pointers that were getting deleted, which is why I expected to
see a memory drop after a removeChild call.  I figured if I saw a memory
drop after some other pointer deletions there would also be a memory drop
after a removeChild.  Is that incorrect?

Thx a lot for the help.

On 11/5/07, Paul Martz <[EMAIL PROTECTED]> wrote:
>
>  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
>
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to