Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 11 Oct 2021 15:59:11 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 259076] pthread_mutex_init fails with limited AS
Message-ID:  <bug-259076-227@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D259076

            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: dynamic-wind@mail.ru

A complex application run in limited address space eventually fails to allo=
cate
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.

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-259076-227>