LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   how to release the virtual memory of pthread? (https://www.linuxquestions.org/questions/linux-server-73/how-to-release-the-virtual-memory-of-pthread-487904/)

jorain 09-29-2006 01:08 AM

how to release the virtual memory of pthread?
 
Hi all,

When i run my program, the virtual memory of that pthread is accumulatively increase. It was running well until the vmsize of that pthread reach the limit, roughly 2GB.

How can i release the virtual memory of pthread?

Thanks for any help.

jlliagre 09-29-2006 01:40 AM

By fixing its memory leak.

jorain 09-29-2006 01:58 AM

Could you advise me how to fix it?
Thanks

jlliagre 09-29-2006 03:50 AM

Please give some clues about what your program is.

What is it doing ?

Did you wrote it yourself ?

In what language is it written ?

jorain 10-03-2006 08:59 PM

It is a simple program written in C language.
I just want to try this first before doing the project.

May i know the sequence of a pthread process?
is it pthread_create(), pthread_join(),pthread_detach(),pthread_cancel()?

thanks

jlliagre 10-04-2006 03:04 PM

Use valgrind to find out where the memory is leaking.

jorain 10-06-2006 01:01 AM

Thanks jlliagre

I tried it and run my program using valgrind --leak-check=yes myprogram

after that
definitely lost=0
possibly lost=0 and
still reachable had some values.

Is it mean that my program does not have memory leak?

jlliagre 10-06-2006 01:35 AM

Likely, so the issue is probably your are allocating memory again and again, with keeping a reference to it.

You can use a heap profiler to figure out what is using this memory:

http://valgrind.org/docs/manual/ms-manual.html


All times are GMT -5. The time now is 12:21 PM.