Hello Rooters!
This may be a simple question, but it was acurring to me from time to time and up to now i was not able to figure out myself the question:
“How do you delete the memory on objects which were created with Clone() function?”
To get more into detail, here:
I have a loop which is called —a lot— of times, in this loop I do want to Clone a histogram in the way:
// LOOP
spectrum_interim = new TH2F(); spectrum_interim=(TH2F*)HistBG[h]->Clone();
spectrum_interim->Reset();
// Do something with this histogram with TSpectrum2 Fitter...
delete spectrum_interim;
// LOOP END
The longer I run this loop, the more memory is taken by my compiled program, so it seems to me that “spectrum_interim” is deleted, but there is sill some memory, induced by Clone() left, which is not freed.
What can I do with this? is there a way to “delete” the Clone memory??? (I am not familiar with this buffer stuff yet…)
Thanks in advance,
Frank
So it seems to me that