Thanks a lot for your response. But changing the two lines (TH1D* hd = new TH1D(); hd = plot->ProjectionX("",50,50);) into one line (TH1D* hd = plot->ProjectionX("",50,50);) doesn't change anything to the heap size... I still get the same numbers as output of gObjectTable->Print() and my application still freezes due to the memory leak. Any other suggestions? Stephane On Wed, 28 Nov 2001, Timothy E. Miller wrote: > On Tue, 2001-11-27 at 20:49, Stephane Tourneur wrote: > > void draw () > > { > > TFile *file = new TFile("Histo2D.root"); > > TString auxhistname = "Trk vs El (d0) ALL CUTS"; > > > > TH2F* plot = (TH2F*)file->Get(auxhistname); > > TH1F* hphi = new TH1F("","",4,0,4); > > TH1D* hd = new TH1D(); > > > > hd = plot->ProjectionX("",50,50); > > At this point, you have replaced the TH1D object you created > with another one generated by the ProjectionX() function call. > When you delete hd later in the code, you delete the ProjectionX() > object and not the one created by the 'new TH1D()' call. > > Thus, the previous line 'TH1D* hd = new TH1D()' is not necessary. > > Also, replace > hd = plot->ProjectionX("",50,50); > with > TH1D* hd = plot->ProjectionX("",50,50); > > As for the difference in size of the leak, I do not know. > Cheers, > -Tim > > >
This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:51:10 MET