Crash when plotting four histograms


Please read tips for efficient and successful posting and posting code

ROOT Version: 6.18-04
Platform: Not Provided
Compiler: Not Provided


Good day

I am trying to run a program that plots for histograms but I get this error:

# terminate called after throwing an instance of 'std::bad_alloc'
what():  std::bad_alloc

I have 10GB of free memory So I am not sure why I get this error.Code is attached
cube.C (2.3 KB)

I will appreciate your help.

Hi,

we can’t run your code since we don’t have access to your tspec_91_cube.root file. From what I see, you seem to clone ggdt_cube four times. I’m guessing it is a TH3D - how many bins does it have? If it’s a lot, and then quadrupled, you can easily go over your 10 GB limit.

Hi Yus

Only is a TH3D, two are TH1D and the last one is TH2D.

As @yus said, we need your ROOT file to run your macro.

I don’t really understand it, I guess we are talking about different histograms. I was referring to this excerpt:

TH3D *cube_1 = (TH3D*)ggdt_cube->Clone("cube_1");
TH3D *cube_2 = (TH3D*)ggdt_cube->Clone("cube_2");
TH3D *cube_3 = (TH3D*)ggdt_cube->Clone("cube_3");
TH3D *cube_4 = (TH3D*)ggdt_cube->Clone("cube_4");

These are for sure four TH3Ds, aren’t they?

Good day

I have attached the root file.

tspec_91_cube.root.tar.gz (1.6 MB)

I do not see the error you mentioned:

% .x cube.C
root [0] 
Processing cube.C...
 FCN=1416.79 FROM MINOS     STATUS=FAILURE       182 CALLS         851 TOTAL
                     EDM=0    STRATEGY= 1  ERROR MATRIX UNCERTAINTY 100.0 per cent
  EXT PARAMETER                APPROXIMATE        STEP         FIRST   
  NO.   NAME      VALUE            ERROR          SIZE      DERIVATIVE 
   1  p0          -9.73950e+06   4.24264e+02   2.12132e+02   0.00000e+00
   2  p1          -6.50617e+01   1.00000e+00   1.00000e+00   0.00000e+00
   3  p2          -5.17713e+07   1.00000e+00   1.00000e+00   0.00000e+00
   4  p3          -4.96792e+07   1.00000e+00   1.00000e+00   0.00000e+00
                               ERR DEF= 0.5
 FCN=1416.79 FROM MINOS     STATUS=FAILURE       182 CALLS         895 TOTAL
                     EDM=0    STRATEGY= 1  ERROR MATRIX UNCERTAINTY 100.0 per cent
  EXT PARAMETER                APPROXIMATE        STEP         FIRST   
  NO.   NAME      VALUE            ERROR          SIZE      DERIVATIVE 
   1  p0          -3.86954e+11   8.48528e+01   4.24264e+01   0.00000e+00
   2  p1          -1.69335e+03   1.00000e+00   1.00000e+00   0.00000e+00
   3  p2           1.73483e+02   1.00000e+00   1.00000e+00   0.00000e+00
   4  p3          -9.68805e+03   1.00000e+00   1.00000e+00   0.00000e+00
                               ERR DEF= 0.5
-1628.29(1.41421) ps
root [1] 

Ok. I think the error my be related to the memory that I have since I have 10GB. I will try to free up some and run again.
Thanks for your help. Much appreciated.

Yes TH1/2/3 are memory resident objects.

Cool. Thanks

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.