[vtkusers] vtkDebugLeaks is leaking memory?

William A. Hoffman bill.hoffman at kitware.com
Mon Mar 11 21:53:32 EST 2002


Half of this has been fixed in the current cvs tree for some time.
(the crashing part)   The leak has not yet been fixed, but I will check in
a fix this week.

Thanks for the bug report.

-Bill

At 12:21 PM 3/10/2002 +0100, Roland Schwarz wrote:
>I found two problems with vtkDebugLeaks:
>
>1) It uses two global objects
>
>static vtkSimpleCriticalSection DebugLeaksCritSec;
>
>and
>
>static vtkPrintLeaksAtExit vtkPrintLeaksAtExitGlobal;
>
>but unfortunately they do not appear in this order in the source file. As a
>result the critsec is beeing destroyed before printleaksatexit, which gives
>reason for an access violation.
>Perhaps this is compiler dependent, but my compiler documentations states:
>
>construction order of global static objects is the same as they appear in
>the source file. The destruction order is the exact reverse.
>
>Simply reordering solves the problem, but is this compiler dependent?
>
>2) vtkDebugLeaks does not free the memory allocated for the HashNodes. This
>usually is not a problem, but when using together with an other framework
>(such as MFC) the resulting leakage is reported there leaving the user
>uncertain of the reason.
>I fixed this by adding a destructor to vtkDebugLeaksHashTable:
>
>vtkDebugLeaksHashTable::~vtkDebugLeaksHashTable()
>{
>   int i;
>   for (i = 0; i < 64; i++)
>     {
>     if (NULL != this->Nodes[i]) delete this->Nodes[i];
>     }
>}
>
>BTW.: Can anyone tell me the 'correct' and polite procedure to report
>problems and/or bug fixes?
>
>Thank you
>Roland
>
>
>
>
>_______________________________________________
>This is the private VTK discussion list.
>Please keep messages on-topic. Check the FAQ at: 
><http://public.kitware.com/cgi-bin/vtkfaq>
>Follow this link to subscribe/unsubscribe:
>http://public.kitware.com/mailman/listinfo/vtkusers





More information about the vtkusers mailing list