Histogram memory leak (?)

From: Krzysztof Zelazowski (Krzysztof.Zelazowski@cern.ch)
Date: Thu Sep 09 1999 - 20:01:17 MEST


Dear Fons,

Thank you for your answer. In fact, I think I found one more, small
leak. This time the problem is seen when creating/deleting histograms.

In case the stack traces attached below are not enough, this is the
scenario which illustrates the problem:

(a) Create a histogram and draw it within fPad
...
fPad->cd();
fHist->Draw();
fPad->Modified();
fPad->Update();

(b) Remove the histogram from the pad
...
//Don't delete the fHist cause it is needed later
if (fHist->TestBit(kCanDelete))
fPad->GetListOfPrimitives()->Remove(fHist);
fPad->Clear();
//As far as I understand, the fPad->Clear() should delete the title &
stats. fPad->Modified();
fPad->Update();
...
(c) finally delete the histogram
...
delete fHist;

After this call, there are ~30 blocks (each 25 bytes) which are not
freed. They all corespond to painting text in TGAxis or TPaveText.
However, I have observed that if insted of (c) one does the following:

(c') Draw the histogram again (like in (a))

Then, the original ~30 blocks are freed, however there are 30 new ones
being created and thus we are back to the starting point.
 
Cheers,
Krzysztof

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
STACK TRACE
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Note: TPad::PaintModified() is called twice ?!

block's size: 25

__builtin_new()                
TList::NewLink()              
TList::AddFirst()
TPad::PaintTextNDC()
TText::PaintTextNDC()
TGaxis::PaintAxis()
TH1::PaintAxis()
TH1::Paint()
TPad::PaintModified()
TPad::PaintModified()
TPad::TCanvas::Update()
TPad::Update()
__________________________

block's size: 25

__builtin_new()
TList::NewLink()
TList::AddFirst()
TPad::PaintText()
TText::PaintText()
TPaveText::PaintPrimitives()
TPaveText::Paint()
TH1::PaintTitle()
TH1::Paint()
TPad::PaintModified()
TPad::PaintModified()
TCanvas::Update()
TPad::Update()

___________________________

block's size: 25

__builtin_new()
TList::NewLink()
TList::AddFirst()
TPad::PaintText()
TText::PaintText()
TPaveText::PaintPrimitives()
TPaveText::Paint()
TH1::PaintStat()
TH1::Paint()
TPad::PaintModified()
TPad::PaintModified()
TCanvas::Update()
TPad::Update()




This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:39 MET