Limit on TH3D?

when I declared a bigger one:
"
TH3D *tcube=new TH3D(hName,hTitle,4096,1,4096,4096,1,4096,4096,1,4096);
"
and tried to fill it , it will crash and report an error:

*** Break *** segmentation violation
Generating stack trace…
0x00000000004023fe in main + 0xeae from ./tdtimecube
0x0000003016d1c4bb in __libc_start_main + 0xdb from /lib64/tls/libc.so.6
0x000000000040144a in __gxx_personality_v0 + 0x3a from ./tdtimecube

But if I declare a smaller one and try to fill it:

TH3D *tcube=new TH3D(hName,hTitle,100,1,4096,100,1,4096,100,1,4096);

my program runs well.

So is there any limit to declare a TH3D??
[/u]

I try different numbers, and

sometimes there is another error message:

terminate called after throwing an instance of 'std::bad_alloc’
what(): St9bad_alloc
Aborted

So it seems it is memory problem, my machine can’t allocate enough memory!!

Does anyone have a good idea?

Yes it is a memory problem: 409640964096*sizeof(double) is 1024 Gb.
(problably about 1024 times bigger than you physical memory)

Cheers,
Philippe.