Re: TH1::Build(), memory leakage

From: Rene Brun <brun_at_pcroot.cern.ch>
Date: Mon, 4 Jul 2005 12:54:17 +0200 (MEST)


When you create an object (eg TH1) with new, it is up to you to manage this object.
See chapter about "Object Ownership" in the Users Guide

Rene Brun

On
Sun, 3 Jul 2005, Margar Simonyan wrote:

> Dear users of ROOT
>
> I would like to know why in TH1::Build() delete hold is
> commented. If one have a function which crates histogram with new then
> there is no (easy) way to avoid memory leakage.
>
> Best regards,
> Margar Simonyan
>
> if (hold) {
> Warning("Build","Replacing existing histogram: %s (Potential
> memory leak).",GetName());
> gDirectory->GetList()->Remove(hold);
> hold->SetDirectory(0);
> // delete hold;
> }
>
Received on Mon Jul 04 2005 - 12:54:21 MEST

This archive was generated by hypermail 2.2.0 : Tue Jan 02 2007 - 14:45:10 MET