On modern Unix systems it is possible to estimate remaining stack space with reasonable accuracy by combining stack limits and the current stack pointer.
The article explores three approaches (getrlimit, pthread_getattr_np, and constructor initialization) and demonstrates a small helper API to inspect available stack space at runtime
1 comment
[ 2.6 ms ] story [ 8.8 ms ] threadThe article explores three approaches (getrlimit, pthread_getattr_np, and constructor initialization) and demonstrates a small helper API to inspect available stack space at runtime