Question about pthread_getspecific with jemalloc

Kristen Eisenberg kristen.eisenberg at
Sat Oct 29 13:15:13 PDT 2011

link with jemalloc.  What happens is, after calling malloc(), the
value of one of my keys seems to change out from under me.  Here is a
small example that demonstrates this:  I am using jemalloc-2.2.1 on
Linux.  If I compile the example with gcc (ver 4.4.3) using the
following command: 'gcc -lpthread main.c' then both calls to
pthread_getspecific return a NULL pointer as expected.  When I link
with jemalloc, however, ('gcc -ljemalloc -lpthread main.c') then the
second call to pthread_getspecific returns some non-NULL value.  Is
this a known bug or am I doing something wrong?

Kristen Eisenberg
Billige Flüge
Marketing GmbH
Emanuelstr. 3,
10317 Berlin
Telefon: +49 (33)
utebachmeier at
- Billige Flüge vergleichen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the jemalloc-discuss mailing list