De-alloc Memory

Jeff Patterson (jeffp@drax.colorado.edu)
Fri, 4 Dec 1998 15:25:34 -0700 (MST)


Hey Rooters,

I am writing a macro that needs to create ALOT of TH1 and TH2.
All of these histograms quickly eat up memory. I want to create a handful
of them, get the numbers from them, deconstruct them (free up their
memory), then construc the next set of them. I deconstruct them, but the
memory does not seem to be freed up after words. I have tried many
things. I use pointer to them.

i.e.
TH1F *one[10];
TH2F *two[10];
for(i=0, i<100, ++i)
{
one = new TH1F( STUFF DEPENDIING ON i);
two = new TH2F(MORE STUFF DEPENDING on i);
.
.
.

//Store the numbers of counts in arrays
//Now it's time to get rid of them !!!

delete[] one;
delete[] two;
}

If I run this loop, all my memory is quickly gone after a couple of
itteration. The delete[] stuff does not seem to be working. I have also
tried free(one[0]); free(one[1]); etc.....
And calling the ~TH1F and ~TH2F desonctructos, and nothing seems
to work. Where am I going wrong ?

Thanks in advance,
Jeff Patterson