Date: Mon, 11 Oct 2021 15:59:11 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=259076 Bug ID: 259076 Summary: pthread_mutex_init fails with limited AS Product: Base System Version: CURRENT Hardware: Any OS: Any Status: New Severity: Affects Some People Priority: --- Component: misc Assignee: bugs@FreeBSD.org Reporter: email@example.com A complex application run in limited address space eventually fails to allocate a mutex. pthread_mutex_init normally calls __thr_calloc which calls __crt_calloc in rtld-malloc.c. When out of memory __crt_calloc calls morecore, which always adds NPOOLPAGES (128K) to the requested size (circa 128 bytes for a mutex). This way pthread_mutex_init and others will eventually fail when the address space is both limited and fragmented. A simple fix will be to retry morepages(amt/pagesz) every time morepages(amt/pagesz + NPOOLPAGES) fails. -- You are receiving this mail because: You are the assignee for the bug.