[Dcmlib] Re: ptotential memory leak without virtual destructor.
Mathieu Malaterre
mathieu.malaterre at kitware.com
Mon Nov 15 03:48:27 CET 2004
> Hi, Mathieu,
>
> >From my point of view, gdcm::ElementSet is the base class for gdcm::Document.So it needs virtual destructor. i will do some tests with this.
That is correct. But again gdcm::ElementSet derives from gdcm::DocEntrySet which has a virtual destructor. Therefore anything deriving from gdcm::DocEntrSet will have virtual destructor. And thus anything deriving from gdcm::ElementSet will have virtual destructor.
BTW, to compile gdcm, we use strong warning level: -Wall from the GNU copiler g++. Wall is a collection of warnings consider to be usefull by most programmer, among this collection is the flag -Wnon-virtual-dtor, which will warn programmer that his code hasn't a virutal dtor when potentially needed (polymorphic classes).
Hoping to be clear this time.
> No special tool was used. just use some tips from http://www.devx.com/DevX/Tip/20465
> Hope you can find and fix memory leaks in gdcm.
>
> In gdcmFile.cxx, pixelConverter is created by new without delete to clean up.
> the codes like following:
>
> PixelConverter = new PixelConvert; //LEAK !
>
> is it intentional or faces some challenging?
When I tried to delete it in the dtor the nightly tests fails...
Mathieu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.creatis.insa-lyon.fr/pipermail/dcmlib/attachments/20041114/3e7c7ea1/attachment.html>
More information about the Dcmlib
mailing list