[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 =
to=20
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=
MF=20
application in Zope).

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

Jim suggested that Python should set the thread stack size itself to some=
thing=20
like 256 * the pointer size, which would work out to 1Mb on 32 bit platfo=
rms=20
and 2Mb on 64 bit platforms. This would hopefully lead to more consistent=
=20
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=
=20
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.

Thoughts?

-Casey=20