[plug] Possible problem with memory leaks

Bret Busby bret at busby.net
Tue Feb 22 09:46:38 WST 2005


On Mon, 21 Feb 2005, Brad Campbell wrote:

> 
> Bret Busby wrote:
>> 
>> Output of free:
>> 
>>              total       used       free     shared    buffers     cached
>> Mem:        762936     575960     186976          0      59240     323376
>> -/+ buffers/cache:     193344     569592
>> Swap:      1052216          0    1052216
>> 
>
> So you are actually using about 193M out of 768. Sounds pretty reasonable to 
> me.
> You have 323M Cached and 59M Buffers. If the system really needs the memory 
> it will dump cache. You have 186M completely free. No problem.
>
> Here are a couple of outputs from my machines for comparison. You can see my 
> laptop has 20M free, but 570M cached. If it needs the memory back it will 
> just reclaim it by dumping cache.
>
> bklaptop:~>free -m
>             total       used       free     shared    buffers     cached
> Mem:          1009        988         20          0         51        570
> -/+ buffers/cache:        366        642
> Swap:          980        477        502
>
> brad at tv:~$ free -m
>             total       used       free     shared    buffers     cached
> Mem:          1515       1480         35          0          0       1104
> -/+ buffers/cache:        375       1140
> Swap:            0          0          0
>
> brad at srv:~$ free -m
>             total       used       free     shared    buffers     cached
> Mem:          1518       1405        112          0         61        995
> -/+ buffers/cache:        348       1169
> Swap:          964         26        938
>
> Here are the major memory consumers on bklaptop as reported by top sorted by 
> memory.
>
> 1513 brad      19   0  181m 130m  24m S  2.0 13.0  16:29.33 thunderbird-bin
> 1515 brad       8   0  181m 130m  24m S  0.0 13.0   0:00.03 thunderbird-bin
> 1516 brad       9   0  181m 130m  24m S  0.0 13.0   0:00.99 thunderbird-bin
> 1518 brad       9   0  181m 130m  24m S  0.0 13.0   0:02.35 thunderbird-bin
> 2566 brad      10   0 90552  81m  16m S  0.3  8.1  14:33.48 firefox-bin
> 2568 brad       8   0 90552  81m  16m S  0.0  8.1   0:00.00 firefox-bin
> 2569 brad       9   0 90552  81m  16m S  0.0  8.1   0:04.46 firefox-bin
> 2571 brad       9   0 90552  81m  16m S  0.0  8.1   0:06.05 firefox-bin
> 3280 brad       8   0 90552  81m  16m S  0.0  8.1   0:00.00 firefox-bin
> 7807 brad       8   0 42128  41m  964 S  0.0  4.1   0:09.14 bk
> 5157 brad       8   0 42116  41m  964 S  0.0  4.1   0:12.77 bk
> 1480 root       9 -10 69540  30m 9636 S  0.7  3.0  29:58.28 XFree86
> 3995 brad       9   0 20016  19m  19m S  0.0  1.9   1:37.89 dosexec
> 3997 brad       9   0 20428  12m  11m S  0.0  1.2   0:09.72 xcrt
> 3796 brad       9   0 11632  11m  11m S  0.0  1.1   0:06.89 dosexec
> 7674 brad       9   0 11304  11m 3440 S  0.0  1.1   0:04.48 wish
>
> Your system looks fine.
> HTH.
> Brad
> -- 
>

After that, I kept going, and tried to use up the available RAM. With 19 
Mozilla browser windows open, with an average of about 7-8 tabs in each 
window, open, I got up to about 80% memory usage. I then quit Mozilla, 
and that changed the memory being used (as opposed to being cached), 
from about 500MB, to about 200MB, with an increase in the cached memory, 
of about 300MB.

I then cleared the cache, and changed the Cache setting, in Mozilla, 
from 50MB to 5MB, as I figured that the amount of the cache, as set, 
would apply to each browser window, and so that I would not get 
anywhere as much memory caching.

I then again quit Mozilla, and restarted it, but the memory usage was 
unchanged.

This morning, with three Mozilla browser windows open, with a total of 
28 tabs open, one Konqueror window with 6 tabs open, and three xterm 
sessions, two with just command prompts (one in an ssh session) and one 
with PINE running, I have 100% memory usage, with 37% in cache.

Outputs follow.

free -m

              total       used       free     shared    buffers     cached
Mem:           745        721         23          0        100        284
-/+ buffers/cache:        336        408
Swap:         1027          2       1024

top

[?7ltop - 08:58:26 up 22:57,  4 users,  load average: 0.00, 0.11, 0.18
Tasks: 111 total,   1 running, 110 sleeping,   0 stopped,   0 zombie
Cpu(s):  20.1% user,   2.8% system,   2.3% nice,  74.9% idle
Mem:    762936k total,   739388k used,    23548k free,   103460k buffers
Swap:  1052216k total,     2872k used,  1049344k free,   290892k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                                          
 5410 bret      16   0   988  988  756 R  9.6  0.1   0:00.13 top                                                              
    1 root       8   0   508  508  456 S  0.0  0.1   0:05.05 init                                                             
    2 root       9   0     0    0    0 S  0.0  0.0   0:00.74 keventd                                                          
    3 root      19  19     0    0    0 S  0.0  0.0   0:00.83 ksoftirqd_CPU0                                                   
    4 root       9   0     0    0    0 S  0.0  0.0   0:00.79 kswapd                                                           
    5 root       9   0     0    0    0 S  0.0  0.0   0:00.00 bdflush                                                          
    6 root       9   0     0    0    0 S  0.0  0.0   0:19.23 kupdated                                                         
    7 root       9   0     0    0    0 S  0.0  0.0   0:00.00 i2oevtd                                                          
    8 root      11   0     0    0    0 S  0.0  0.0   6:10.14 kjournald                                                        
  108 root       9   0     0    0    0 S  0.0  0.0   0:00.00 khubd                                                            
  112 root       8   0   308  304  264 S  0.0  0.0   0:00.01 udevd                                                            
  207 root       9   0     0    0    0 S  0.0  0.0   2:36.95 kjournald                                                        
  209 root       9   0     0    0    0 S  0.0  0.0   0:00.02 kjournald                                                        
  210 root       9   0     0    0    0 S  0.0  0.0   0:14.32 kjournald                                                        
  211 root       9   0     0    0    0 S  0.0  0.0   0:00.11 kjournald                                                        
  212 root       9   0     0    0    0 S  0.0  0.0   0:00.08 kjournald                                                        
  729 daemon     9   0   444  444  376 S  0.0  0.1   0:00.00 portmap                                                          
  805 root       9   0   804  804  700 S  0.0  0.1   0:00.72 syslogd                                                          
  808 root       9   0  1272 1272  448 S  0.0  0.2   0:00.39 klogd                                                            
  824 root       9   0  3032 3032 1488 S  0.0  0.4   0:34.69 cupsd                                                            
  842 messageb   9   0   992  992  872 S  0.0  0.1   0:00.07 dbus-daemon-1                                                    
  972 root       9   0   728  728  656 S  0.0  0.1   0:00.00 inetd                                                            
  981 root       9   0   968  968  856 S  0.0  0.1   0:00.94 atalkd                                                           
  985 root       9   0   692  692  596 S  0.0  0.1   0:00.00 papd                                                             
  987 root       9   0  1260 1260 1056 S  0.0  0.2   0:00.03 afpd                                                             
 1063 postgres   9   0  2196 2196 2112 S  0.0  0.3   0:00.11 postmaster                                                       
 1068 postgres   9   0  2976 2976 1936 S  0.0  0.4   0:00.04 postmaster                                                       
 1069 postgres   9   0  2044 2044 1936 S  0.0  0.3   0:00.04 postmaster                                                       
 1076 postgres   9   0  1700 1700 1372 S  0.0  0.2   0:00.45 pg_autovacuum                                                    
 1080 root       9   0  1864 1864 1404 S  0.0  0.2   0:00.39 nmbd                                                             
 1086 root       9   0  1536 1532 1304 S  0.0  0.2   0:00.00 sshd                                                             top - 08:58:29 up 22:57,  4 users,  load average: 0.00, 0.11, 0.18

Tasks: 113 total,   1 running, 110 sleeping,   0 stopped,   2 zombie
Cpu(s):   1.3% user,   3.3% system,   0.0% nice,  95.4% idle
Mem:    762936k total,   739472k used,    23464k free,   103468k buffers
Swap:  1052216k total,     2872k used,  1049344k free,   290904k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                                          
 5410 bret      15   0  1088 1088  848 R  1.6  0.1   0:00.18 top                                                              
    8 root      14   0     0    0    0 S  1.3  0.0   6:10.18 kjournald                                                        
12101 bret      11   0 92316  90m  22m S  1.0 12.1  21:18.23 mozilla-bin                                                      
 1163 bret      10   0  1924 1924 1124 S  0.3  0.3   0:03.55 famd                                                             
    1 root       8   0   508  508  456 S  0.0  0.1   0:05.05 init                                                             
    2 root       9   0     0    0    0 S  0.0  0.0   0:00.74 keventd                                                          
    3 root      19  19     0    0    0 S  0.0  0.0   0:00.83 ksoftirqd_CPU0                                                   
    4 root       9   0     0    0    0 S  0.0  0.0   0:00.79 kswapd                                                           
    5 root       9   0     0    0    0 S  0.0  0.0   0:00.00 bdflush                                                          
    6 root       9   0     0    0    0 S  0.0  0.0   0:19.23 kupdated                                                         
    7 root       9   0     0    0    0 S  0.0  0.0   0:00.00 i2oevtd                                                          
  108 root       9   0     0    0    0 S  0.0  0.0   0:00.00 khubd                                                            
  112 root       8   0   308  304  264 S  0.0  0.0   0:00.01 udevd                                                            
  207 root       9   0     0    0    0 S  0.0  0.0   2:36.95 kjournald                                                        
  209 root       9   0     0    0    0 S  0.0  0.0   0:00.02 kjournald                                                        
  210 root       9   0     0    0    0 S  0.0  0.0   0:14.32 kjournald                                                        
  211 root       9   0     0    0    0 S  0.0  0.0   0:00.11 kjournald                                                        
  212 root       9   0     0    0    0 S  0.0  0.0   0:00.08 kjournald                                                        
  729 daemon     9   0   444  444  376 S  0.0  0.1   0:00.00 portmap                                                          
  805 root       9   0   804  804  700 S  0.0  0.1   0:00.72 syslogd                                                          
  808 root       9   0  1272 1272  448 S  0.0  0.2   0:00.39 klogd                                                            
  824 root       9   0  3032 3032 1488 S  0.0  0.4   0:34.69 cupsd                                                            
  842 messageb   9   0   992  992  872 S  0.0  0.1   0:00.07 dbus-daemon-1                                                    
  972 root       9   0   728  728  656 S  0.0  0.1   0:00.00 inetd                                                            
  981 root       9   0   968  968  856 S  0.0  0.1   0:00.94 atalkd                                                           
  985 root       9   0   692  692  596 S  0.0  0.1   0:00.00 papd                                                             
  987 root       9   0  1260 1260 1056 S  0.0  0.2   0:00.03 afpd                                                             
 1063 postgres   9   0  2196 2196 2112 S  0.0  0.3   0:00.11 postmaster                                                       
 1068 postgres   9   0  2976 2976 1936 S  0.0  0.4   0:00.04 postmaster                                                       
 1069 postgres   9   0  2044 2044 1936 S  0.0  0.3   0:00.04 postmaster                                                       
 1076 postgres   9   0  1700 1700 1372 S  0.0  0.2   0:00.45 pg_autovacuum                                                    [?25h[?7h

ps -axu --sort:rss | tail

bret      1373  0.0  2.1 31352 16264 ?       S    Feb21   0:00 nautilus --sm-config-prefix /nautilus-RtzxPF/ --sm-client-id 11c0a80233000110632567300000018510004 --screen 0 --no-default-window
bret      1374  0.0  2.1 31352 16264 ?       S    Feb21   0:00 nautilus --sm-config-prefix /nautilus-RtzxPF/ --sm-client-id 11c0a80233000110632567300000018510004 --screen 0 --no-default-window
bret      1375  0.0  2.1 31352 16264 ?       S    Feb21   0:00 nautilus --sm-config-prefix /nautilus-RtzxPF/ --sm-client-id 11c0a80233000110632567300000018510004 --screen 0 --no-default-window
bret      1376  0.0  2.1 31352 16264 ?       S    Feb21   0:00 nautilus --sm-config-prefix /nautilus-RtzxPF/ --sm-client-id 11c0a80233000110632567300000018510004 --screen 0 --no-default-window
bret      1669  0.3  5.9 59844 45248 ?       S    Feb21   4:51 /usr/bin/konqueror --profile webbrowsing
root      1228 17.4 10.0 96504 76796 ?       S<   Feb21 240:32 /usr/X11R6/bin/X :0 -audit 0 -auth /var/lib/gdm/:0.Xauth -nolisten tcp vt7
bret     12101  2.1 12.0 109272 92304 ?      S    Feb21  21:18 /usr/lib/mozilla/mozilla-bin
bret     12116  0.0 12.0 109272 92304 ?      S    Feb21   0:01 /usr/lib/mozilla/mozilla-bin
bret     12117  0.0 12.0 109272 92304 ?      S    Feb21   0:06 /usr/lib/mozilla/mozilla-bin
bret     12119  0.0 12.0 109272 92304 ?      S    Feb21   0:25 /usr/lib/mozilla/mozilla-bin

Does that appear okay?

It seems to me to be using too much memory, for what is running, and, 
whilst the second data line of the free command, shows 408MB to be used 
as cached (if I read that correctly), the first line of the data output 
for that, shows only 23MB as free, and 284MB as cached, which is less 
than either of the numbers on the second line.

An issue here, is that the memory usage appears to have increased since 
yesterday, when I was running a higher load, in terms of open browser 
windows and tabs, and, in a previous session when I had similar memory 
usage displayed, when I tried to load open office, it gutted itself and 
had to be re-installed. I had assumed that that was due to memory 
overload.

I do not know whether it was a similar scenario when I was previously 
running Konqueror, and in the process of an operation using Konqueror, 
the system committed suicide and had to be re-installed (re-install of 
Debian Sarge, not just an application). At that time, when Konqeruor 
went awry, and I went to a text console (<CTRL><ALT><Fx>), I got 
continuous scrolling of a line stating that the ext3 journalling was 
failing. I had to try to go to a text console that way, as I ccould not 
get an xterm window to open, in X-Windows, at that time. There was no 
login prompt displayed, just that line of scrolling text. Then, the 
system progressively chopped itself up from the inside, and in the end, 
would not boot. That was in the last couple of weeks.

A problem with all of this, is that it appears that, in running Debian 
Sarge, and/or, in using Mozilla, the proposition of being able to leave 
a Linux box running indefinitely, relative to the famous "run Windows 9x 
for 29 days, and it is guaranteed to have a system crash", does not 
appear to be valid, as it appears that I cannot run Debian Sarge as a 
workstation, for more than a few hours, or, maybe, even up to a day, 
without needing to reboot it, to free up memory.

And, I am concerned that reinstalling the operating system may become 
something like a weekly or monthly requirement.

I am not trying to go into trolling - I believe that I have a problem, 
with memory not being properly released, and it appears to make Debian 
Sarge, unstable, when Debian Sarge is used as a workstation.

I assume that Debian Sarge does not have a utility that can be run, that 
frees up memory that is not being directly used by running applications 
and running utilities?

For the problems involved, I think it would be better to not have the 
memory caching, as the instability is more of a sacrifice than the 
benefit of faster loading of applications via caching, that has been 
mentioned as the reason for the cached memory. I am assuming that it is 
that the memory allocated for caching, is what is taking up all of the 
memory that is used, that is not directly used by running applications 
and utilities.

--
Bret Busby
Armadale
West Australia
..............

"So once you do know what the question actually is,
  you'll know what the answer means."
- Deep Thought,
   Chapter 28 of
   "The Hitchhiker's Guide to the Galaxy:
   A Trilogy In Four Parts",
   written by Douglas Adams,
   published by Pan Books, 1992 
....................................................



More information about the plug mailing list