LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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.

Notices


Reply
  Search this Thread
Old 12-16-2008, 07:32 AM   #1
itz2000
Member
 
Registered: Jul 2005
Distribution: Fedora fc4, fc7, Mandrake 10.1, mandriva06, suse 9.1, Slackware 10.2, 11.0, 12.0,1,2 (Current)]
Posts: 732

Rep: Reputation: 30
Unknown program memory leaks FAST, 1.5 GB/2 Minutes


Hello,
One of the program installed on my Slackware 12.1 leaks very very fast, it can be anything, what I want to ask you is how to check which thing is leaking?

I've noticed it leaks 1.5 GB of memory in about 2 minutes after X is up, and stays with 30MB of free memory, only.

top didn't gave me any results since I can see what takes memory but cannot see whom took it and never gave it back.
dmesg didn't give any indication.



any tips?
 
Old 12-16-2008, 07:53 AM   #2
H_TeXMeX_H
LQ Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301
Well, it would be nice if you post the output of 'free' at or near the time at which this happens. Also, run 'top' and sort by memory usage.
 
Old 12-16-2008, 10:00 AM   #3
itz2000
Member
 
Registered: Jul 2005
Distribution: Fedora fc4, fc7, Mandrake 10.1, mandriva06, suse 9.1, Slackware 10.2, 11.0, 12.0,1,2 (Current)]
Posts: 732

Original Poster
Rep: Reputation: 30
Quote:
Originally Posted by H_TeXMeX_H View Post
Well, it would be nice if you post the output of 'free' at or near the time at which this happens. Also, run 'top' and sort by memory usage.
Code:
top - 17:57:35 up  2:37,  4 users,  load average: 0.06, 0.05, 0.01
Tasks:  87 total,   2 running,  85 sleeping,   0 stopped,   0 zombie
Cpu(s):  1.3%us,  0.3%sy,  0.0%ni, 98.3%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:   1554884k total,  1510988k used,    43896k free,   361940k buffers
Swap:  4385736k total,     2548k used,  4383188k free,   912696k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                                         
 2559 root      20   0  357m  64m 8300 S  1.3  4.3   1:55.56 X                                                               
 2571 root      20   0  357m  64m 8300 S  0.0  4.3   0:00.00 X                                                               
 3100 cookie    20   0  167m  62m  18m S  0.0  4.1   0:11.29 firefox-bin                                                     
 2650 cookie    20   0 75720  20m 7512 S  0.0  1.3   0:07.44 artsd                                                           
 2667 cookie    20   0 25416  17m 7992 R  0.0  1.2   0:04.94 Terminal                                                        
 2634 cookie    20   0 34012  17m  12m S  0.0  1.1   0:02.46 kicker                                                          
 2630 cookie    20   0 30692  16m  12m S  0.0  1.1   0:02.92 kdesktop                                                        
 2615 cookie    20   0 31232  15m  12m S  0.0  1.0   0:00.54 kded                                                            
 2633 cookie    20   0 30792  14m  11m S  0.0  1.0   0:00.58 kicker                                                          
 2629 cookie    20   0 29288  14m  11m S  0.0  0.9   0:00.48 kdesktop                                                        
 2625 cookie    20   0 28788  13m 9.8m S  0.0  0.9   0:01.46 kwin                                                            
 2658 cookie    20   0 34588  13m   9m S  0.0  0.9   0:00.26 knotify                                                         
 2961 cookie    20   0 28064  12m 9940 S  0.0  0.8   0:00.08 kio_uiserver                                                    
 2642 cookie    20   0 27420  11m 9420 S  0.0  0.8   0:00.10 kxkb                                                            
 2626 cookie    20   0 27376  11m 9364 S  0.0  0.8   0:00.32 kwin                                                            
 2655 cookie    20   0 26336  11m 8908 S  0.0  0.7   0:00.56 klipper                                                         
 2652 cookie    20   0 25780 9868 7844 S  0.0  0.6   0:00.10 kaccess                                                         
 2624 cookie    20   0 25488 9820 7772 S  0.0  0.6   0:00.08 ksmserver                                                       
 2640 cookie    20   0 26108 9696 7416 S  0.0  0.6   0:00.20 khotkeys                                                        
 2639 cookie    20   0 25808 9464 7336 S  0.0  0.6   0:00.04 khotkeys                                                        
 2613 cookie    20   0 26456 8580 6896 S  0.0  0.6   0:00.08 klauncher                                                       
 2608 cookie    20   0 24676 7944 6192 S  0.0  0.5   0:00.06 kdeinit                                                         
 2635 cookie    20   0 25104 7732 5908 S  0.0  0.5   0:00.02 kio_file                                                        
 2435 haldaemo  20   0  6808 4992 2964 S  0.0  0.3   0:00.60 hald                                                            
 2505 cookie    20   0  4964 3384 1248 S  0.0  0.2   0:00.20 bash                                                            
 2611 cookie    20   0 24108 3124 1560 S  0.0  0.2   0:00.12 dcopserver                                                      
 2797 cookie    20   0  3624 2044 1252 S  0.0  0.1   0:00.02 bash                                                            
 2918 cookie    20   0  3616 1996 1208 S  0.0  0.1   0:00.02 bash                                                            
 2913 root      20   0  3060 1708 1228 S  0.0  0.1   0:00.04 bash                                                            
 3094 cookie    20   0  3312 1656 1008 S  0.0  0.1   0:00.00 run-mozilla.sh                                                  
 2576 cookie    20   0  3264 1616 1020 S  0.0  0.1   0:00.02 startkde                                                        
 2542 cookie    20   0  3256 1600 1012 S  0.0  0.1   0:00.00 startx                                                          
 3082 cookie    20   0  3252 1584 1000 S  0.0  0.1   0:00.00 firefox                                                         
 2575 cookie    20   0  3240 1544  972 S  0.0  0.1   0:00.00 xinitrc                                                         
 2617 cookie    20   0  3124 1472  956 S  0.0  0.1   0:00.04 gam_server                                                      
 1032 root      16  -4  2536 1284  468 S  0.0  0.1   0:00.64 udevd                                                           
 2241 root      20   0  2544 1128  684 S  0.0  0.1   5:42.50 mount.ntfs-3g                                                   
 2448 root      20   0  3184 1116  988 S  0.0  0.1   0:00.78 hald-addon-stor                                                 
 2442 root      20   0  3184 1112  980 S  0.0  0.1   0:00.10 hald-addon-inpu

sorted by mem usage.

I cannot restart right now, but free would give me something like this :

Code:
# free
             total       used       free     shared    buffers     cached
Mem:       1554884     146588    1408296       0     362008     912940
-/+ buffers/cache:     233348    1321536
Swap:      4385736       2548    4383188
...
..
..
..sleep 120 seconds
..
...
#free
             total       used       free     shared    buffers     cached
Mem:       1554884    1508296      46588          0     362008     912940
-/+ buffers/cache:     233348    1321536
Swap:      4385736       2548    4383188


any other stuff?
thanks!
 
Old 12-16-2008, 10:58 AM   #4
tuxdev
Senior Member
 
Registered: Jul 2005
Distribution: Slackware
Posts: 2,012

Rep: Reputation: 115Reputation: 115
Try using twm rather than KDE. Then, you can see exactly which app makes the system start going bad.
 
Old 12-16-2008, 12:48 PM   #5
H_TeXMeX_H
LQ Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301
You should know that the output of 'free' may be misleading. The most important line is not the first line, but the second. So this output:
Code:
             total       used       free     shared    buffers     cached
Mem:       1554884    1508296      46588          0     362008     912940
-/+ buffers/cache:     233348    1321536
Swap:      4385736       2548    4383188
does NOT suggest anything is wrong, because in this case you would have '1321536' kB of RAM free. This is because the difference is disk cache, which can be freed by the kernel as necessary.

As for top, are you meaning to run two xservers ? Even if you do, they're only using 4 % of your total RAM each.
 
Old 12-16-2008, 04:25 PM   #6
itz2000
Member
 
Registered: Jul 2005
Distribution: Fedora fc4, fc7, Mandrake 10.1, mandriva06, suse 9.1, Slackware 10.2, 11.0, 12.0,1,2 (Current)]
Posts: 732

Original Poster
Rep: Reputation: 30
if so, I had no problem, but what does the bolded line in top means?!
Code:
top - 17:57:35 up  2:37,  4 users,  load average: 0.06, 0.05, 0.01
Tasks:  87 total,   2 running,  85 sleeping,   0 stopped,   0 zombie
Cpu(s):  1.3%us,  0.3%sy,  0.0%ni, 98.3%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:   1554884k total,  1510988k used,    43896k free,   361940k buffers
Swap:  4385736k total,     2548k used,  4383188k free,   912696k cached
 
Old 12-16-2008, 05:56 PM   #7
Uxinn
Member
 
Registered: May 2008
Location: Iceland
Distribution: Ubuntu Hardy
Posts: 47

Rep: Reputation: 16
Have you tried 'ps aux' ?
 
Old 12-17-2008, 02:21 AM   #8
H_TeXMeX_H
LQ Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301
Unfortunately 'top' does not calculate that value with respect to disk cache.
 
Old 12-17-2008, 03:04 AM   #9
ErV
Senior Member
 
Registered: Mar 2007
Location: Russia
Distribution: Slackware 12.2
Posts: 1,202
Blog Entries: 3

Rep: Reputation: 62
Quote:
Originally Posted by itz2000 View Post
Hello,
One of the program installed on my Slackware 12.1 leaks very very fast, it can be anything, what I want to ask you is how to check which thing is leaking?

I've noticed it leaks 1.5 GB of memory in about 2 minutes after X is up, and stays with 30MB of free memory, only.

top didn't gave me any results since I can see what takes memory but cannot see whom took it and never gave it back.
dmesg didn't give any indication.



any tips?
Linux uses a lot of memory for caching, which is normal. Does this memory leak lead to slowly increasing swapfile usage, followed by running out of all available memory and system crash? If not, then situation might be normal - linux system can use up to 2 gigabytes of RAM for caching, and you won't run out of memory - memory will be available when something needs it. So unless you see increasing swapfile usage, followed by crash, everything is fine. Here is my "free -m" output for comparison:
Code:
             total       used       free     shared    buffers     cached
Mem:          2026       1957         69          0         33       1516
-/+ buffers/cache:        407       1618
Swap:          972          2        969
 
  


Reply



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 leaks mailsrinu28 Programming 4 08-07-2007 07:15 PM
how to check for memory leaks Four Programming 4 11-18-2006 11:41 PM
frustrating memory leaks xushi Slackware 18 08-10-2005 06:13 AM
how to detect memory leaks abirami Linux - Networking 2 11-08-2004 05:35 AM
Memory Leaks? stampede96 Linux - Software 3 02-20-2003 12:52 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:59 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