Welcome to the most active Linux Forum on the web.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 05-19-2005, 12:55 PM   #1
Registered: Dec 2003
Location: Canada
Distribution: Suse 10
Posts: 206

Rep: Reputation: 30
memory leak ?


we have created a little (about 2600 lines) c program to caculate some statistic
this program run on a linux embedded system (sixnet)

we have used thread in this program

with the command top we got:

PID virt res shr
6258 832 832 660

after a few time we got
6258 856 856 676

it's seem to have a memory leak...

we don't use maloc, new...

does thread can create this problem?

Old 05-19-2005, 01:45 PM   #2
jim mcnamara
Registered: May 2002
Posts: 964

Rep: Reputation: 34
if threads are lefting "hanging" they use up memory.

However, as a program runs it may periodically calls brk() and and if it does it then expands it's actual memory usage.
Programs hold onto memory - this is not under your control - in case more is needed later on.

setrlimit() can control this memory expansion. If you set limits using RLIMIT_AS this will control the max size of the process working set in memory.

If you can run your code outside of the embedded environment, try using valgrind to check for memory leaks.


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 leak?! nyk Programming 10 01-24-2005 07:08 PM
what is memory leak blackzone Programming 6 11-05-2004 10:32 AM
Memory Leak when using memory debugging C program on SuSE SLES8 babalina Linux - Distributions 0 10-06-2003 09:39 AM
Memory Leak? eLinux Linux - General 2 09-20-2003 09:21 PM
Memory Leak FredrikN Linux - General 4 09-17-2002 03:16 PM

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

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