Re: TMapFile reuse

From: Fons Rademakers (Fons.Rademakers@cern.ch)
Date: Thu Apr 22 1999 - 22:23:29 MEST


Hi Judith,

   thanks for reporting this problem, I've fixed it.
The problem was that the TClass object associated with the TH1F
class was allocated in the shared memory during the first execution
of the macro. Running the macro again the system tried to access
again this TClass object, but the address, pointing to the previous
map file, was now invalid. I now force the creation of the TClass
to be on the heap.

Cheers, Fons.


PS: if you need this fix urgently I can tell you the few lines
    to change in the source of TMapFile.

PS2: since a TH1 is a "special" object (i.e. an object that is
     automatically added to the current directory) you don't have
     to call mfile->Add() explicitely.



Judith Katzy wrote:
> 
> hi rooters,
> 
> I tried to reuse the following macro twice witin an interactive
> ROOT session. It works fine, when I run it ones, but it gives a seg.fault
> at the mfile->Update(eh1), when I execute it for the second time.
> 
> {
> TMapFile *mfile = TMapFile::Create("histo.map","RECREATE", 500000,
>                             "Memory mapped file with histogram");
> TH1F *eh1   = new TH1F("eh1","nevent",100,0.,99.);
> mfile->Add(eh1,"eh1");
> mfile->Update(eh1);
> mfile->ls();
> delete eh1;
> mfile->Close();
> }
> 
> Does somebody has an idea, what goes wrong?
> 
> cheers,
> Judith

-- 
Org:    CERN, European Laboratory for Particle Physics.
Mail:   1211 Geneve 23, Switzerland
E-Mail: Fons.Rademakers@cern.ch              Phone: +41 22 7679248
WWW:    http://root.cern.ch/~rdm/            Fax:   +41 22 7677910



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:32 MET