Bug 432721

Summary: pthread_create leaks memory
Product: Red Hat Enterprise Linux 4 Reporter: Julien Pierre <julien.pierre.boogz>
Component: glibcAssignee: Jakub Jelinek <jakub>
Status: CLOSED NOTABUG QA Contact: Brian Brock <bbrock>
Severity: high Docs Contact:
Priority: low    
Version: 4.0CC: kengert, wtc
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2008-02-14 08:19:19 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Julien Pierre 2008-02-13 23:57:47 UTC
Description of problem:

Calls to pthread_create cause the following leak :

==4020== 204 bytes in 3 blocks are possibly lost in loss record 5 of 7
==4020==    at 0x442AC82: calloc (vg_replace_malloc.c:279)
==4020==    by 0x410EDEB: _dl_allocate_tls (in /lib/ld-2.3.2.so)
==4020==    by 0x45C826D: allocate_stack (in /lib/tls/libpthread-0.60.so)
==4020==    by 0x45C7EF7: pthread_create@@GLIBC_2.1 (in
/lib/tls/libpthread-0.60.so)

Version-Release number of selected component (if applicable):

We saw this on both RHEL 3 and RHEL 4, with glibc

Our RHEL4 box has
libc-2.3.4-2.25

And RHEL3 :
glibc-2.3.2-95.37

See https://bugzilla.mozilla.org/show_bug.cgi?id=367376 for more details.

Comment 1 Jakub Jelinek 2008-02-14 08:19:19 UTC
What makes you think this is a leak?  NPTL has a cache of thread stacks prepared
for reuse, so the memory is still accessible.  If you 1000 times pthread_create
followed by 1000 pthread_join calls, you won't get 1000 unfreed blocks.