[vtkusers] Delete actor and release memory
Nicolas Rannou
nicolas.lists at gmail.com
Wed Jul 6 17:34:51 EDT 2011
On Wed, Jul 6, 2011 at 4:06 PM, John Drescher <drescherjm at gmail.com> wrote:
> On Wed, Jul 6, 2011 at 3:56 PM, Nicolas Rannou <nicolas.lists at gmail.com>
> wrote:
> >
> >
> > On Wed, Jul 6, 2011 at 3:43 PM, John Drescher <drescherjm at gmail.com>
> wrote:
> >>
> >> On Wed, Jul 6, 2011 at 10:35 AM, Xiaofeng Z <xf10036 at hotmail.com>
> wrote:
> >> > That's interesting, and quite unintuitive! maybe someone with better
> >> > understanding of VTK's inner work can offer an explanation!
> >> >
> >>
> >> To me this looks like garbage being left over after the object was
> >> deleted. You need to look at the reference counts before the delete
> >> not after.
> >>
> >> John
> >
> > How could I avoid garbage being left over?
>
> What I mean is after the Delete if the object was really deleted the
> reference counts could be not trusted because the memory holding the
> reference counts would be freed. I would trace through the code to see
> what exactly is happening.
>
> John
>
Ok I see what you mean now.
I'll try to debug it step by step and see what is happening...
I used to rely on the system monitor to get a gross approximation of the
memory usage but it looks like it is quite not reliable.
I debugged my program with massif (
http://valgrind.org/docs/manual/ms-manual.html) and the memory usage looks
fine.
(the memory usage decreases significantly after deleting actors, mappers and
polydatas)
A surprising thing is that, if I run my program with this heap profiler
tool, the ref counts of the polydatas, mappers and actors are "accurate"
(==0) after deleting the objects. The same program without the heap profiler
returns weird ref counts after deleting the objects.
I'm wondering if the memory usage looks fine into massif because the ref
counts are corrects (==0) or if the system monitor is just wrong and the ref
counts don't really matter.
In other words, if I get ref counts == 0 in my program (without heap
profiler), would I be able to see the memory usage decrease in the system
monitor?
Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20110706/e7d54be0/attachment.htm>
More information about the vtkusers
mailing list