From: jarek on
Hello!

I've problem with memory leak. After a long investigation. I'm
suspecting, that some threads doesn't release their resources.
The program starts thousands of threads, and it is not easy to to find
when it happens.
Is it possible to analyze program memory (i.e. core file), to find
thread ids, which didn't released resources ?

Best regards
Jarek
From: David Schwartz on
On Apr 16, 6:03 am, jarek <ja...(a)nospam.pl> wrote:

>         I've problem with memory leak. After a long investigation.. I'm
> suspecting, that some threads doesn't release their resources.
>         The program starts thousands of threads, and it is not easy to to find
> when it happens.
>         Is it possible to analyze program memory (i.e. core file), to find
> thread ids, which didn't released resources ?

It's not worth saving. Re-architect so that you re-use a small number
of threads rather than creating a large numbers of threads.

DS
From: David Given on
On 16/04/10 14:03, jarek wrote:
[...]
> I've problem with memory leak. After a long investigation. I'm
> suspecting, that some threads doesn't release their resources.
> The program starts thousands of threads, and it is not easy to to
> find when it happens.
> Is it possible to analyze program memory (i.e. core file), to find
> thread ids, which didn't released resources ?

Go get valgrind:

http://valgrind.org/

(It's in most Linux distros, if you use Linux.) Run your program with
this and it will tell you exactly what you want to know.

--
┌─── dg@cowlark.com ───── http://www.cowlark.com ─────

│ "In the beginning was the word.
│ And the word was: Content-type: text/plain" --- Unknown sage
From: Jarek on
David Given pisze:

> Go get valgrind:
>
> http://valgrind.org/


I'm using valgrind, but didn't find any option for thread tracking.
memcheck doesn't report any leaks.
I suspect that in some cases, pthread_join is not called.

best regards
Jarek