[Python-Dev] Python Thread Stack Size
Martin v. Loewis
14 May 2002 20:54:52 +0200
Casey Duncan <email@example.com> writes:
> It seems that FreeBSD has a default thread stack size of 64K
Can you point to any documentation that says this is the case?
> Jim suggested that Python should set the thread stack size itself to
> something like 256 * the pointer size, which would work out to 1Mb
> on 32 bit platforms and 2Mb on 64 bit platforms. This would
> hopefully lead to more consistent behavior across platforms.
I think the stack size should accommodate for sys.getrecursionlimit,
with a generous estimate of how much one recursion (in ceval)
consumes. There not much point of setting the default to a higher
value, since you will get an exception anyway if you exhaust the
In addition, I think on platforms supporting setstacksize, the thread
stack size should be runtime variable, so that sys.setrecursionlimit
can expand the stack reserve estimate if necessary.