Re: [ROOT] Memory leak in TDirectory->Get ?

From: Rene Brun (Rene.Brun@cern.ch)
Date: Tue Jun 18 2002 - 18:58:47 MEST


You should not Get the directory, but cd to it.

Rootfile->cd(dirname);
MyDataClass* old=(MyDataClass*)gDirectory->Get("data");

Rene Brun

On Tue, 18 Jun 2002, Egon Pavlica wrote:

> Hello to anybody siting behind screens,
> 
> i have a problem in my program. I use root v3.01/06 version on redhat7.3 
> athlon 1600+. I have writen a program and i have noticed that his size in 
> memory is constantly increasing in the certain place. I wonder, where is 
> this memory leak (or is only the leak in my knowledge?) 
> 
> TDirectory* where=(TDirectory*)Rootfile->Get("dirname");
> MyDataClass* old=(MyDataClass*)->Get("data");
> ...
> do calculation
> ...
> old->Write("data",TObject::kOverwrite);
> delete old; 
> 
> ps. besides i wonder if i should delete "where"?
> 
> thanks a lot, Egon
> 
> 
> ------------------------------------------
> Egon Pavlica egon.pavlica@p-ng.si
> Laboratory for epitaxy and nanostructures
> Nova Gorica Polytechnic (www.p-ng.si)
> tel.+386-5-3315-332
> ------------------------------------------
> 



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:57 MET