This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug malloc/22111] New: Maloc's new per thread cache is not returned when thread exits


https://sourceware.org/bugzilla/show_bug.cgi?id=22111

            Bug ID: 22111
           Summary: Maloc's new per thread cache is not returned when
                    thread exits
           Product: glibc
           Version: 2.26
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: malloc
          Assignee: unassigned at sourceware dot org
          Reporter: zegentzy at protonmail dot com
  Target Milestone: ---

Created attachment 10403
  --> https://sourceware.org/bugzilla/attachment.cgi?id=10403&action=edit
Makes 1000 batches of 10 threads then ends them. Then prints out memory
consumption before exiting.

Description:
glibc 2.26 now enables a per-thread cache to malloc by default. 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() causing many/most memory profiling tools (memcheck,
massif, heapcheck, etc) unable to either detect a) its existence or b) its
source.

For applications which create and remove lots of threads, this can quickly
consume gigabytes of memory, with the source of the consumption appearing 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

I rereported this issue 3 days ago here: https://bugs.archlinux.org/task/55532

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

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]