[Python-Dev] Python Thread Stack Size

Casey Duncan casey@zope.com
Tue, 14 May 2002 12:30:36 -0400

Hi All:

For those of you who don't know me, I am Casey Duncan, a recent addition =
the engineering team at Zope corp.=20

Jim Fulton and I were talking about a problem that manifests itself on BS=
D in=20
threaded Python applications that use a lot of stack space (notably the C=
application in Zope).

It seems that FreeBSD has a  default thread stack size of 64K, whereas mo=
unices have somewhere more like 1Mb. A patch exists to have Python bump u=
the stack size, but this involves patching the Python source.

Jim suggested that Python should set the thread stack size itself to some=
like 256 * the pointer size, which would work out to 1Mb on 32 bit platfo=
and 2Mb on 64 bit platforms. This would hopefully lead to more consistent=
behavior across platforms.

Alternately (or additionally) it could be a configure option like=20
--thread-stack=3D1024 or somesuch.

A third alternative (which is less desireable IMO) would be to change the=
Python BSD port so that it includes a patch to do this. Obviously that=20
doesn't help ppl building directly from source very much tho.