This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug nptl/13433] New: pthread_create allocates big chunks of memory when launching several threads simultaneously (race condition?)
- From: "sources at shustrik dot com" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sources dot redhat dot com
- Date: Thu, 24 Nov 2011 11:05:23 +0000
- Subject: [Bug nptl/13433] New: pthread_create allocates big chunks of memory when launching several threads simultaneously (race condition?)
- Auto-submitted: auto-generated
http://sourceware.org/bugzilla/show_bug.cgi?id=13433
Bug #: 13433
Summary: pthread_create allocates big chunks of memory when
launching several threads simultaneously (race
condition?)
Product: glibc
Version: 2.11
Status: NEW
Severity: normal
Priority: P2
Component: nptl
AssignedTo: drepper.fsp@gmail.com
ReportedBy: sources@shustrik.com
Classification: Unclassified
Created attachment 6074
--> http://sourceware.org/bugzilla/attachment.cgi?id=6074
C++ code that simulates the problem
First of all, this is not related to the stack size setting.
The behaviour that I'm experiencing is that pthread_create allocates 64Mb
chunks of memory (seen as [anon] in pmap) when multiple threads are being
started simultaneously. This doesn't happen, if I add a slight delay between
thread starts, and threads are created sequentially. At first I blamed boost,
but then I discovered it happens without boost as well, with direct
pthread_create calls. The attached code can be used to show the problem (C++,
requires boost, let me know if You need me to upload a C version).
I get the following output:
~> ./test 2 boost 0
Thread count 2 - Delay 0 - Boost - memory used: 93.5 (1.1) Mbytes
~> ./test 2 pthread 0
Thread count 2 - Delay 0 - Pthread - memory used: 93.5 (1.1) Mbytes
~> ./test 2 boost 10
Thread count 2 - Delay 10 - Boost - memory used: 29.5 (1.1) Mbytes
~> ./test 2 pthread 10
Thread count 2 - Delay 10 - Pthread - memory used: 93.5 (1.1) Mbytes
~> ./test 2 pthread 10
Thread count 2 - Delay 10 - Pthread - memory used: 93.5 (1.1) Mbytes
~> ./test 2 pthread 10
Thread count 2 - Delay 10 - Pthread - memory used: 29.5 (1.1) Mbytes
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.