|
From: tom f. <tf...@sc...> - 2008-12-03 17:29:54
|
forgot to CC the list..
------- Forwarded Message
Reply-To: tf...@sc...
From: tom fogal <tf...@al...>
To: Frank Mertens <fr...@cy...>
Subject: Re: [Valgrind-users] valgrind reporting memory leaks with pthread_getspecific()/pthread_setspecific
In-Reply-To: Your message of "Wed, 03 Dec 2008 11:05:50 +0100."
<493...@cy...>
References: <493...@cy...>
Date: Wed, 03 Dec 2008 10:30:07 -0700
Frank Mertens <fr...@cy...> writes:
> I'm using TLS for performance reasons in nearly all my applications.
> For each thread there is a singleton object and I'm storing its global
> pointer in the TLS table.
> Although I checked about these singletons being destroyed correctly
> valgrind still reports those memory chunks as definitely lost.
> Anybody heard about a similar issue?
I know glibc has some cleanup code which (by default) is never run,
which has caused issues for valgrind in past days. Particularly with
pthreads, I see problems that I chalk up to this issue somewhat
frequently.
You might try looking into the implementation to see if this is true,
and see if there is an environment variable or something that you can
set to force full cleanup. Another good test is to write a small
program:
main() {
int *myptr;
create_tls();
myptr = malloc(4);
set_tls(key, malloc(sizeof(int)));
myptr = get_tls(key);
free(myptr);
return 0;
}
and see if that causes the `leak'.
- -tom
------- End of Forwarded Message
|
|
From: Frank M. <fr...@cy...> - 2008-12-04 11:48:31
|
tom fogal wrote:
> forgot to CC the list..
>
> ------- Forwarded Message
>
> Reply-To: tf...@sc...
> From: tom fogal <tf...@al...>
> To: Frank Mertens <fr...@cy...>
> Subject: Re: [Valgrind-users] valgrind reporting memory leaks with pthread_getspecific()/pthread_setspecific
> In-Reply-To: Your message of "Wed, 03 Dec 2008 11:05:50 +0100."
> <493...@cy...>
> References: <493...@cy...>
> Date: Wed, 03 Dec 2008 10:30:07 -0700
>
> Frank Mertens <fr...@cy...> writes:
>> I'm using TLS for performance reasons in nearly all my applications.
>> For each thread there is a singleton object and I'm storing its global
>> pointer in the TLS table.
>> Although I checked about these singletons being destroyed correctly
>> valgrind still reports those memory chunks as definitely lost.
>> Anybody heard about a similar issue?
>
> I know glibc has some cleanup code which (by default) is never run,
> which has caused issues for valgrind in past days. Particularly with
> pthreads, I see problems that I chalk up to this issue somewhat
> frequently.
>
> You might try looking into the implementation to see if this is true,
> and see if there is an environment variable or something that you can
> set to force full cleanup. Another good test is to write a small
> program:
>
> main() {
> int *myptr;
> create_tls();
> myptr = malloc(4);
> set_tls(key, malloc(sizeof(int)));
> myptr = get_tls(key);
> free(myptr);
> return 0;
> }
>
> and see if that causes the `leak'.
>
> - -tom
Oh, thx, good point to start.
--
Frank
|