This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: memory
- From: Eljay Love-Jensen <eljay at adobe dot com>
- To: <esg at unife dot it>, gcc-help at gcc dot gnu dot org
- Date: Mon, 14 Oct 2002 06:51:24 -0500
- Subject: Re: memory
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