memory
Eljay Love-Jensen
eljay@adobe.com
Mon Oct 14 04:51:00 GMT 2002
Hi Josef,
>> Declaring char a[15000000] gives me segmentation fault with g++ (on
RedHat 7.1). Any suggestions?
Your stack isn't big enough. Make your stack larger when you compile/run
your program.
Alternatively, declare your char a[15000000] variable on the heap via
"char* a = new char[15000000];", remember to manage the memory with a
"delete[] a". Better yet, use a "vector<char> a(15000000, '\0');", which
will manage the memory for you.
--Eljay
More information about the Gcc-help
mailing list