[issue25323] Bus error: 10 when executing recursive program
eryksun
report at bugs.python.org
Tue Oct 6 09:25:55 EDT 2015
eryksun added the comment:
I don't know about OS X, but in 64-bit Linux I can increase the recursion limit to 100000 if I allow the main thread to grow to 64 MiB by setting the RLIMIT_STACK soft limit. For example:
soft, hard = resource.getrlimit(resource.RLIMIT_STACK)
soft = max(soft, 64 << 20)
if hard != resource.RLIM_INFINITY:
soft = min(soft, hard)
resource.setrlimit(resource.RLIMIT_STACK, (soft, hard))
Alternatively it also works to use a worker thread with a fixed 64 MiB stack size, set as follows:
old_size = threading.stack_size(64 << 20)
# create worker thread
threading.stack_size(old_size)
----------
nosy: +eryksun
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue25323>
_______________________________________
More information about the Python-bugs-list
mailing list