Max bin number in histogramm

Hallo rooters!

I’ve got a histogramm with 1.9845e+6 entries I want to plot in a TH1F.

TH1F *h1 = new TH1F(“h1”,“title”,p,0,nentries).

When I replace p with nentries, the error “type G__exception” occurs. But when I decrease the number of bins, i.e. p = nentries/2, it works.

Is there a limitation of max. bin-entries?

Thanks!

Check how much RAM you are trying to allocate (if “p” is big …).
For a single TH1F histogram, if p = nentries = 1.9845e+6 then there should be no problem (the amount of RAM used by such a TH1F would be something like 8 MB without “Sumw2” and something like 24 MB with “Sumw2”).

I must edit my post. The error only occurs when I want to draw the hist, writing isn’t a problem. But when I want to open the hist with the root browser nothing happens.
Methods like “inspect” works fine, all written entries are shown correctly. When I click on “draw panel” or any other method which would show me the hist, root crashes.

The below macro works fine for me …

{
  Int_t nentries = 1984500;
  Int_t p = nentries;
#if 0 /* 0 or 1 */
  TH1::SetDefaultSumw2(); // note: makes drawing much longer
#endif /* 0 or 1 */
  TH1F *h1 = new TH1F("h1", "title", p, 0, nentries);
  for (Int_t i = 0; i < nentries; i++)
    h1->Fill( gRandom->Rndm() * nentries, gRandom->Rndm() );
  h1->Draw();
}

Thank you, this works fine. But my entry number is 1.9845e+7. This was my fault, sorry :frowning: . In this case your example doesn’t work, too.

So, I tried my above macro with p = nentries = 1.9845e+7 and I get no problems (ROOT v5-34-19 / Linux x86_64 gcc 4.8.2).

Try to check:
[bash]$ ulimit -S -a
[bash]$ ulimit -H -a
[tcsh]$ limit
[tcsh]$ limit -h
and make sure that you do not exceed any limits (e.g. try to increase the “stack size” soft limit).

Is there any possibiliy to do this on windows?