[SDL] Array size limit?

Göttling Thomas Goettling at TMC-Multimedia.de
Mon Feb 12 02:42:28 PST 2007


>Is there some kind of a limit in SDL for the amount of memory that can 
>be allocated? I'm trying to allocate space for double[57000000] (don't 
>ask why) but it causes an access violation/segmentation fault. Even 
>double[270000] seems to be too much. Without SDL I can easily allocate 
>the memory I need (actually about 453 megabytes of it). I've tried 
>allocating the memory both statically and dynamically.

Hi,

Depending WHERE you allocate this Memory, it will be reserved on the Stack.
Depending on your Environment - Stack is often limited to 8 MB or even
smaller.

Try:
Double *doubleField = malloc( sizeof( double) * 57000000 );
Instead, in order to reserve the Memory on Heap.

There might also be a Problem reserving more Memory than is available on
your System. Check your available RAM within your System tools (top /
Sysmon,...). 

Regards

Thomas Göttling



More information about the SDL mailing list