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
[ 3.4 ms ] story [ 13.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