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

Re: [MiNT] Default Stack Size



Hi Mark! :)

That's why I suggested the binutils make a sane default but really I don't know what a sane default is. I never really thought a program would need more than 64KB of stack space but G++ easily proves me wrong ;) I guess I think small ;)

IMO there is simply no sane default. Current Linux application code bases (the ones that are being ported to FreeMiNT) do not care about the stack size and easily contain for example functions like the one below. It is extremely easy to consume a stack of any size today.

Therefore the only viable solution is to build dynamically expanding stack capabilities into the kernel.

STanda


------------ Cut ----------

// should consume approx 4kB per call.
int recursiveStackHog( int n ) {
	long buffer[1024];
        // ... do something
        if ( n <= 0 ) return 0;

	return recursiveStackHog( n - 1);
}