Mail Archives: djgpp/1999/05/30/05:26:23
On Sat, 29 May 1999, Brian Ronk wrote:
> I have been recieving an error that I am assuming is a memory error.
> My program starts up, but never actually runs anything. It quits
> with a 255 code, with a message about SIGSEGV. I found out what in
> my program was causing the error. I declared an array of size 50 of
> a type that was about 230444 bytes large. (it is a map class if you
> are wondering) I figured out that this won't work on my computer
> since that needs about 11 megs of memory
Is the array automatic? In other words, is it declared inside one of
the functions?
If so, then you are trashing the run-time stack, which is by default
512KB and cannot be enlarged after the program starts. See section
15.9 of the FAQ for more details.
Generally, for such large arrays, it is a bad idea to declare them
automatic. Instead, allocate the storage at run time using `malloc'.
Then you have all the virtual memory at your disposal.
- Raw text -