On this page
threading.stack_size
Prev: threading.settrace_all_threads | Up: threading | Next: threading.Thread
Rel: threading.active_count, threading.Barrier, threading.BoundedSemaphore, threading.BrokenBarrierError
Ref: docs.python.org — threading.stack_size
Tags: #public #python3 #stdlib #threading
Import
import threading
from threading import stack_size
Signature & Overview
threading.stack_size(size=0, /)
Return the thread stack size used when creating new threads. The optional size argument specifies the stack size (in bytes) to be used for subsequently created threads, and must be 0 (use platform or
Usage
import threading
current = threading.stack_size() # 0 means OS default
assert isinstance(current, int)
Gotchas
- Only affects newly created threads: Setting too small a stack size (minimum is 32 KiB) can cause segfaults in C extensions; leave at
0(OS default) unless tuning deep recursion or thread memory.
REPL Inspect
from threading import stack_size
help(stack_size)
Linked from
Related notes
- tuts/python3/stdlib_module/threading/settrace_all_threads Linked here; links to this page; shared tags: #stdlib, #threading
- tuts/python3/stdlib_module/threading/Thread Linked here; links to this page; shared tags: #stdlib, #threading
- tuts/python3/stdlib_module/threading Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/threading/active_count Linked here; shared tags: #stdlib, #threading
- tuts/python3/stdlib_module/threading/Barrier Linked here; shared tags: #stdlib, #threading
- tuts/python3/stdlib_module/threading/BoundedSemaphore Linked here; shared tags: #stdlib, #threading
- tuts/python3/stdlib_module/threading/BrokenBarrierError Linked here; shared tags: #stdlib, #threading
- tuts/python3/stdlib_module/threading/Condition shared tags: #stdlib, #threading
- tuts/python3/stdlib_module/threading/current_thread shared tags: #stdlib, #threading
- tuts/python3/stdlib_module/threading/enumerate shared tags: #stdlib, #threading