471,610 Members | 1,368 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,610 software developers and data experts.

Memory usage limits

When I create an char array with more than approx 1,000,000 elements, I seem to run up against a stack overflow problem. I'm assuming that WinXP is only assigning a small amount of memory for this process. How do I get around this issue and increase the array size to one I'll need (approx 10,000,000 elements)?
Nov 16 '05 #1
1 1310

"Jeff Laidlaw" <an*******@discussions.microsoft.com> wrote in message
news:34**********************************@microsof t.com...
When I create an char array with more than approx 1,000,000 elements, I

seem to run up against a stack overflow problem. I'm assuming that WinXP is
only assigning a small amount of memory for this process. How do I get
around this issue and increase the array size to one I'll need (approx
10,000,000 elements)?

Allocate your array on the heap (with new or malloc) instead of the stack.
Consider using std::vector.

By default, your threads get only 1 or 2Mb of stack space. You can increase
the stack size using the linker /STACKSIZE: option, but you're better off
just getting such large arrays off the stack.

-cd
Nov 16 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Zac | last post: by
1 post views Thread by Bob Kochem | last post: by
2 posts views Thread by David Miller | last post: by
4 posts views Thread by Frank Esser | last post: by
20 posts views Thread by iouswuoibev | last post: by
49 posts views Thread by vfunc | last post: by
1 post views Thread by Jean-Paul Calderone | last post: by
12 posts views Thread by bomahony | last post: by
1 post views Thread by XIAOLAOHU | last post: by
reply views Thread by MichaelMortimer | last post: by
reply views Thread by CCCYYYY | last post: by
1 post views Thread by ZEDKYRIE | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.