Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how large can be the allocation in stack?

Status
Not open for further replies.

kai2005

Programmer
Oct 8, 2005
21
DE
the code like this:

int main()
{
int intArray[10000][10000]; //I got no problem,
//but I got problem in run time
//now I think the space demand
//is too large.
//now the question is, how can I know
//how large maximum will be stack?
// some code more ...
return 0;
}
 
Salem,

thanks for your answer.

I have not used VC, but just compile my code with gcc. How can I deal with this problem?
 
I have just made a test, till 721*722*4 Byte is still ok. above this will get problem. And 721*721*4 = 1.98MB That mean, the default max stack size for gcc is 2MB.

I don't know how can I make some changement by setting of stack size.
 
> I have not used VC, but just compile my code with gcc.
You should have said so, since you posted on a compiler specific forum.
Which version of gcc (there are many different ports for windows).
Cygwin / MinGW / dev-c++ / DJGPP ?

You could always do
[tt]static int largeArray[1000][1000];[/tt]

--
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top