TH2 memory limit

Hi,

How much memory can be allocated per TH2 histogram?

My code kept crashing during the run time, due to fill in the TH2F histogram.
It was a supplementary plot to fill the “run number” and the “time stamp” in 2D histograms.
In the end, I just made the output txt file, instead of histogram.

But out of curiosity. I assume it crashed due to the memory limitation of TH2 histogram?
The Nbins of x axis is 13,563
The Nbins of y axis is 17,000,000
Hence it would be the bins of N_x * N_y = 2.3 * 10 ^ 11

and assume that one integer(4 byte) is filled per bin, then in byte, it is approximately
1 TB…

I believe this is the reason of crash?
Or maybe other defects of my code…–> anyway I gave up on this histogram…

How much memory can be allocated per TH2 histogram?

A TH2F provides a float per cell (four bytes). If the cell contents will be small one could use a TH2C which provides a char per cell (one byte).

If you are only filling a small number of bins you could use THnSparse instead of a TH2.

TH2 are memory resident objects. The maximum size of an histogram is limited by the available memory on your machine.

Wouldn’t it be more useful to store these values in a TGraph?