Memory leak in THistPainter.cxx

Hello ROOTers,

Using the Microsoft DebugDiag tool, it reports a memory leak in THistPainter.cxx .
I am using root v5-30-00.
The problem is that function PaintTitle() allocates a TPaveText on the heap with new, and does not free the TPaveText. The TPaveText address is assigned to a local, so no other module can free it.
Can you confirm this is a bug?

Leak 32 bytes
msvcr90d!operator new[]+f
libGraf!G__cpp_setup_initG__Graf::~G__cpp_setup_initG__Graf+79498
libHistPainter!THistPainter::PaintTitle+2f8
PaintTitle()
{

TPaveText *ptitle = new TPaveText(xpos, ypos-ht, xpos+wt, ypos,“blNDC”); //ptitle is never deallocated
}

thanks very much
buddy

Can you try with a more recent version ? 5-34 ?

By looking at 5.34 source code, the issue remains the same.
The new object address is assigned to a local, so I don’t think any other code can free it.

We cannot delete ptile. If we do that then the title will be removed form the list in the pad and it will not be possible to move it interactively. Just try …

Hi,

The code:

ptitle->SetBit(kCanDelete); ptitle->Draw(); delegates the ownership of the TPaveText to the TPad …

Cheers,
Philippe.