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

[MiNT] stack size!



On Fri, 29 Jan 1999 11:22:52 +0200 (EET), Martin-Eric Racine wrote:

MR>> Btw,. How come we always (most of the time) need to change the stack size?
MR>
MR>Yesterday, I realized that most "illegal instructions" and "buss errors"
MR>we encounter are caused by an insufficiently small stack.
MR>
MR>In my case, it´s been CC1 always crashing in the middle of compiling

Heh! Recently I was porting an MP3 encoder (originally written for WIN32
but already ported to about 6 platforms including Solaris, OS/2 and of
course Linux). Well, I got it to compile in a few minutes but then spent
three(!) days by debugging. Whenever I run the encoder it freezed my
whole computer. Shame I have no memory protection, I always had to use
the last-resort button.

Anyway, at last (after disabling about every single line of that
program) I realized it was freezing due to stack being too small. OK I
have seen this several times before (but I keep forgetting that :-).
Sure I can fixstk it, but how much memory is enough? 32kB? 128kB? 512kB?
At last I put there 2 MB (paranoia) but I still don´t know if it was
enough.

I would love to know how to determine the stack size (maybe there´s a
compiler switch for generating additional code that would check the
stack during program run and list the stack usage at the program exit?).
Real solution would be to make the stack dynamical, but this would
probably slow the applications down quite a bit :-(

Petr
--
E-mail: stehlik@cas3.zlin.vutbr.cz                        PARCP developer
   WWW: http://cas3.zlin.vutbr.cz/~stehlik/              MiNTOS/Linux user
mirror: http://users.zln.cz/~pstehlik/                 Atari 800XL emulation
mirror: http://www.stehlik.cyberstrider.org/              Atari Falcon040