[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [MiNT] Default Stack Size



Hi,

On Thursday 19 February 2009, Vincent Rivière wrote:
> > Therefore the only viable solution is to build dynamically expanding
> > stack capabilities into the kernel.
>
> A dynamically expanding stack cannot be implemented without Virtual
> Memory. So as long as Virtual Memory is not available in the FreeMiNT
> kernel, the only solution is to use a fixed stack size for each process,
> which is inherently insane as you have demonstrated.

For threads Linux actually uses fixed sized stack (in latest kernels 8MB),
but with virtual memory it of course gets physically allocated only when
it's written to.


	- Eero

PS. On one device I saw a program that crashed when running out of address
space (2GB) because it leaking thread resources (stacks) by not joining
threads it had created as joinable.  We found this after wondering how
the program could produce 2GB core dumps in a device that has only 128MB RAM
and no swap... :-)