Dima Sorkin wrote:
On 12/3/06, Digvijoy Chatterjee wrote:
Thanks,
the heap allocation code (malloc) ran without a problem..
so does a stack overflow mean ,that the stack can grow only to a
maximum size in the memory ??..who sets this ,and how does one change
this..
ulimit
10,000,000 integers seems very little to overflow the stack.
It is a least 40MB which seems unreasonably high. See below on my
machine (in kB):
bash-3.00$ ulimit -s
10240
On my current (32-bit Windows) platform:
$ ulimit -s
2032
So, if you intend portable code, you surely can't count on availability
of larger stacks. 1MB per thread used to be a typical hard limit for
static linked 32-bit linux libraries. The 1MB per thread stack thing
was ubiquitous enough to require hardware level changes since the
original P4, which had cache mapping conflicts ("64k aliasing") between
stacks at 1MB intervals, as implemented by the most popular C platform.
The hardware fix still is vulnerable to problems with stacks at
intervals of multiples of 8MB, if I understand the situation correctly.
Standard C, of course, says nothing about stacks and their sizes, but it
doesn't say that you can ignore limitations of common platforms.