Hi,
Please could you get me out of your mailing list?
I am in your mailing list in spite of me and it seems I am not concerned at all. Furthermore, I don't understand anything of the contents of your e-mails.
Thank you for erasing my name from your mailing list, "root" something.
Carole Le Gall
-----Message d'origine-----
De : owner-roottalk_at_pcroot.cern.ch
[mailto:owner-roottalk_at_pcroot.cern.ch] De la part de Rene Brun
Envoyé : lundi 4 juillet 2005 16:18
À : Margar Simonyan
Cc : Roottalk
Objet : Re: [ROOT] TH1::Build(), memory leakage
Hi,
On Mon, 4 Jul 2005, Margar Simonyan wrote:
>
> in "Object Ownership" chapter it is written that histograms are owned
by
> gDirectory (default) . I create TH1 object with new, it is added to
> gDirectory list, if I call delete operator, then we have double delete
> problem, since gDirectory will try to delete object, is it right ?
No, if you delete an histogram in a directory, it is automatically removed from the directory.
> Another related question. In THStack documentation it is
> written, "The THStack owns the objects in the list". What it means ?
> I create TH1 object with new, add to stack with
> THStack::Add(). Should I delete TH1 object with delete operator. I
suppose
> no, since it is owned by THStack.
THStack clearly stpulates that it owns the histogram. In this case you should not try to delete the histogram yourself.
Rene brun
>
> Margar Simonyan
>
> On Mon, 4 Jul 2005, Rene Brun wrote:
>
>> 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 - 17:20:32 MEST
This archive was generated by hypermail 2.2.0 : Tue Jan 02 2007 - 14:45:10 MET