[Python-Dev] stack check on Unix: any suggestions?

Martin v. Loewis martin@loewis.home.cs.tu-berlin.de
Wed, 30 Aug 2000 20:37:56 +0200


> My SGI has getrlimit(RLIMIT_STACK) which should do the trick

It tells you how much stack you've got; it does not tell you how much
of that is actually in use.

> Unix code will also have to differentiate between running on the
> main stack and a sub-thread stack, probably.

My patch computes (or, rather, estimates) a start-of-stack for each
thread, and then saves that in the thread context.

> And I haven't looked at the way PyOS_CheckStack is implemented on
> Windows

It should work for multiple threads just fine. It tries to allocate 8k
on the current stack, and then catches the error if any.

Regards,
Martin