LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 09-29-2006, 01:08 AM   #1
jorain
LQ Newbie
 
Registered: Aug 2006
Posts: 5

Rep: Reputation: 0
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.
 
Old 09-29-2006, 01:40 AM   #2
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
By fixing its memory leak.
 
Old 09-29-2006, 01:58 AM   #3
jorain
LQ Newbie
 
Registered: Aug 2006
Posts: 5

Original Poster
Rep: Reputation: 0
Could you advise me how to fix it?
Thanks
 
Old 09-29-2006, 03:50 AM   #4
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
Please give some clues about what your program is.

What is it doing ?

Did you wrote it yourself ?

In what language is it written ?
 
Old 10-03-2006, 08:59 PM   #5
jorain
LQ Newbie
 
Registered: Aug 2006
Posts: 5

Original Poster
Rep: Reputation: 0
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
 
Old 10-04-2006, 03:04 PM   #6
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
Use valgrind to find out where the memory is leaking.
 
Old 10-06-2006, 01:01 AM   #7
jorain
LQ Newbie
 
Registered: Aug 2006
Posts: 5

Original Poster
Rep: Reputation: 0
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?
 
Old 10-06-2006, 01:35 AM   #8
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Memory release Kvetch Linux - General 1 08-16-2006 05:02 PM
virtual memory newbiesforever Linux - General 11 06-29-2006 01:07 PM
Memory release nicola54 Linux - General 7 06-17-2005 09:04 PM
RH 8.0 Mapping Virtual Memory to get access to VMIC Reflective Memory PCI card. Merlin53 Linux - Hardware 0 05-05-2003 12:50 PM
How do you release memory? Paul12 Linux - General 1 08-22-2001 04:02 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 01:37 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration