FS#55532 - [glibc] Malloc's new per thread cache is not returned when thread exits
Attached to Project:
Arch Linux
Opened by Freya Gentz (zegentz) - Wednesday, 06 September 2017, 07:07 GMT
Last edited by Bartłomiej Piotrowski (Barthalion) - Monday, 09 October 2017, 09:23 GMT
Opened by Freya Gentz (zegentz) - Wednesday, 06 September 2017, 07:07 GMT
Last edited by Bartłomiej Piotrowski (Barthalion) - Monday, 09 October 2017, 09:23 GMT
|
Details
Description:
glibc 2.26 enables a new per-thread cache to malloc. This cache consumes around 1.23 kB of memory per thread created. This cache however is not released when the thread exits. This cache can't be detected with malloc_heap() and many/most memory profiling tools (memcheck, massif, heapcheck, etc) either. For applications which create and remove lots of threads, this can quickly consume gigabytes of memory, while the source of the consumption appears to be unknown. This issue was originally reported in 2010 at https://bugzilla.redhat.com/show_bug.cgi?id=640286 and https://bugzilla.redhat.com/show_bug.cgi?id=598498 Additional info: Happens in: glibc 2.26-1 and glibc 2.26-2 Steps to reproduce: 1) Compile attached file. 2) Run it and wait for ~25 seconds 3) Look at VmRSS of ~127300 kB |
This task depends upon
Closed by Bartłomiej Piotrowski (Barthalion)
Monday, 09 October 2017, 09:23 GMT
Reason for closing: Fixed
Additional comments about closing: glibc 2.26-5
Monday, 09 October 2017, 09:23 GMT
Reason for closing: Fixed
Additional comments about closing: glibc 2.26-5
Comment by
Adrian Petrescu (apetresc) -
Thursday, 07 September 2017, 16:43 GMT
Comment by loqs (loqs) - Thursday,
07 September 2017, 19:05 GMT
Comment by Freya Gentz (zegentz) -
Thursday, 07 September 2017, 22:13 GMT
Comment by Freya Gentz (zegentz) -
Thursday, 07 September 2017, 22:27 GMT
Comment by A. S. (TheDaemoness) -
Saturday, 09 September 2017, 17:54 GMT
Legitimate question: if this bug is related to a new per-thread
cache enabled in glibc 2.26, how was the bug originally reported
in 2010?
Have you reported the issue upstream at
https://sourceware.org/bugzilla/
?
Adrian Petrescu (apetresc): It was made in in 2010 and was
disabled by default (being experimental). In glibc 2.26 it was
changed to being enabled by default. It can now be disabled using
the "--disable-experimental-malloc" (build?) flag.
loqs (loqs): I've now reported it here:
https://sourceware.org/bugzilla/show_bug.cgi?id=22111#add_comment
glibc 2.26 has just landed in the main repositories, and this bug
still appears to be present. Preloading a different malloc
implementation (i.e. jemalloc) suppresses the issue, but IMHO that
should not be necessary.