How to increase program memory allocation

When I try to initialize a 300 * 300 * 4 3D array in a C program, my program stops working and reports an error. The system I use has 3 GB of RAM, which should be sufficient. Is there a way to increase the amount of memory allocated to the program? I am using Dev C ++ on Windows Vista.

+5
source share
4 answers

Use either malloc()/ free()(or new[]/ delete[]for C ++), or a global array, or a local static array. If you try to create a non-static array inside a function, it will be allocated on the stack, and the stacks are usually not very large.

; , , x86 , .

+11

, .

"Linker | System | Stack Reserve Size"

+3

3 , , , , , , , .

++, , Boost?

boost::multi_array<int, 3> x (boost::extents[300][300][4]);
+2

Dev++, gcc ld-. -stack stacksize, , . Dev++, .

, - Dev++ - . IDE - Code:: Blocks , Dev++ ++.

+2

All Articles