Re: TMapFile

Fons Rademakers (Fons.Rademakers@cern.ch)
Fri, 28 Aug 1998 11:11:22 +0200


Hi Piergiorgio,

is the producer a standalone program? If so then generally it will map
the file in a region that can not be access by ROOT. To solve this problem
use the static function TMapFile::SetMapAddress()
(http://root.cern.ch/root/html/TMapFile.html#TMapFile:SetMapAddress) and
read the description of how to use this method.

Cheers, Fons.

Piergiorgio Cerello wrote:
>
> Dear rooters,
>
> I get a segmentation fault when trying to open a memory mapped file.
>
> Here is the producer's code:
>
> ...
>
> TH1F *lmdmult;
>
> ...
>
> TMapFile *mmap = TMapFile::Create("lmd.map","RECREATE", 2000000,"Lmd
> memory mapped file with histograms");
> mmap->Print();
>
> ...
>
> lmdmult = new TH1F("lmdmult","lmd multiplicity",200,-0.5,199.5);
>
> ...
>
> (loop) {
>
> ...
>
> lmdmult->Fill((Float_t) nhlmd);
>
> ...
>
> mmap->Update();
> mmap->ls();
> }
>
> The output is:
>
> Memory mapped file: lmd.map
> Title: Lmd memory mapped file with histograms
> Option: CREATE
> Mapped Memory region: 0x407a7000 - 0x4098f480 (1.91 MB)
> Current breakval: 0x407af000
>
> ...
>
> lmdmult TH1F 1320 (from mmap->ls();)
>
> When I try to access the lmd.map file from a ROOT session, I give:
>
> TMapFile *mfile = TMapFile::Create("lmd.map");
>
> and I get back:
>
> Segmentation fault
> bash$
>
> Something different happens if I give a small size to the .map file.
> With 20000 istead of 2000000, I can access the file from the consumer,
> but I get a segmentation fault when I try to update it from the producer.
>
> Any suggestion?
>
> Thanks,
>
> Piergiorgio

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