Question about pthread_getspecific with jemalloc

Ethan Burns burns.ethan at
Tue Jun 14 13:48:55 PDT 2011


I am experiencing strange behavior with pthread_getspecific when I
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?


P.S. I am not subscribed to the list so please make sure to CC me in
any responses.

More information about the jemalloc-discuss mailing list