Re: root crashes when creating large histogram/histograms with certan number of channels

From: David Gonzalez Maline <David.Gonzalez.Maline_at_cern.ch>
Date: Fri, 6 Nov 2009 14:10:43 +0100


Hi,

Just some simple maths would help.

5001 xbins * 5001 ybins * 4bytes each bin * 40 histograms ~= 3.72 GB of memory...

Obviously in the second machine you don't get such an error until you change the number of bins to a much bigger number. Consider using THnSparse instead and/or reducing the number of bins.

David

Plamen Boutachkov wrote:
> Hello,
>
> I need to create a large number of TH2I, this leads to a crash. Here
> is an example script which reproduces the problem:
>
> {
> Int_t nHistograms = 40 ;
> TH2I *h[nHistograms] ;
>
> for(Int_t nIndex = 0; nIndex < nHistograms ; ++nIndex ) {
> TString sHistogramNname = Form("h%d",nIndex);
> cout<<"Histogram Number:"<< nIndex << endl;
>
> h[nIndex] = new TH2I(sHistogramNname.Data(),sHistogramNname.Data()
> ,5001,0.,5000.
> ,5001,0.,5000.);
> }
> }
>
> executing the script gives:
>
> Histogram Number:0
> ...
> Histogram Number:29
> Histogram Number:30
> Error: Symbol G__exception is not defined in current scope
> scripts/test.C:11:
> Error: type G__exception not defined FILE:/tmp/test.C LINE:11
> *** Interpreter error recovered ***
>
> If I include the above loop in a stand alone program the error is:
> Histogram Number:0
> ...
> Histogram Number:30
> terminate called after throwing an instance of 'std::bad_alloc'
> what(): std::bad_alloc
> Aborted
>
>
> I can produce a similar error by executing:
>
> TH2D *t = new TH2D("test","t",30000,0.,1.,30000,0.,1.)
> Error: Symbol G__exception is not defined in current scope (tmpfile):1:
> Error: type G__exception not defined FILE:(tmpfile) LINE:1
>
> or
>
> root [0] TH2D *t = new TH2D("test","t",40000,0.,1.,40000,0.,1.)
> Error: Symbol G__exception is not defined in current scope (tmpfile):1:
> Error: type G__exception not defined FILE:(tmpfile) LINE:1
>
> On other hand creating a larger histograms:
>
> root [0] TH2D *t = new TH2D("test","t",50000,0.,1.,50000,0.,1.)
> or
> root [0] TH2D *t = new TH2D("test","t",60000,0.,1.,60000,0.,1.)
> or
> root [0] TH2D *t = new TH2D("test","t",70000,0.,1.,70000,0.,1.)
> works.
>
> I am running ROOT 5.24/00b on a 32bit machine with 3GB of memory.
>
> I tried the same on a 64bit machine, 24GB of memory, root Version
> 5.18/00b
> executing
>
> root [0] TH2D *t = new TH2D("test","t",30000,0.,1.,30000,0.,1.)
>
> does not give an error, but
>
> root [0] TH2D *t = new TH2D("test","t",40000,0.,1.,40000,0.,1.)
> Error: Symbol G__exception is not defined in current scope (tmpfile):1:
> Error: type G__exception not defined FILE:(tmpfile) LINE:1
>
> Regards,
> Plamen
>
> --
> -----------------------------
> Dr. Plamen Boutachkov
> Kernstruktur, GSI Darmstadt
> Planckstr. 1
> D-64291 Darmstadt
> Germany
>
> Tel: +49 6159-71-2436
> Fax: +49-6159-71-2898
> -----------------------------
>
>
>
Received on Fri Nov 06 2009 - 14:10:39 CET

This archive was generated by hypermail 2.2.0 : Fri Nov 06 2009 - 17:50:03 CET