Solved

memory usage, memory clearing

Posted on 1997-07-29
4
316 Views
Last Modified: 2013-12-15
I have a Linux box on a dual pentium with 98 MB RAM as several servers.  It has about 10 aliases with apache running on them, named, sendmail, and a pop3 server.  I can run it just fine on 64 MB RAM and get the same speed.

My problem is all of the memory is in use.  Here is a ps -faxm:
  PID TTY MAJFLT MINFLT   TRS   DRS  SIZE  SWAP   RSS  SHRD   LIB  DT COMMAND
    2  ?       0      0     0     0     0     0     0     0     0   0 (kflushd)
    3  ?       0      0     0     0     0     0     0     0     0   0 (kswapd)
  316  ?       1      4    12   260   272     0   272   224     0  12 update (bdflush)
  313   2     73     10    12   280   292     0   292   240     0  13 /sbin/mingetty tty2
  314   3     72     10    12   280   292     0   292   240     0  13 /sbin/mingetty tty3
   21  ?      34    132    16   292   308     0   308   248     0  15 /sbin/kerneld
  283  ?       5      7    32   300   332     0   332   280     0  13 gpm -t Microsoft
    1  ?     158     32    24   316   340     0   340   276     0  16 init [3]
  160  ?      33     15    32   316   348     0   348   284     0  16 lpd
  149  ?      18  48374    20   348   368     0   368   300     0  17 inetd
 1249  ?     211     54    36   516   552     0   552   432     0  30  \_ in.telnetd
 1250  p0    136     78    24   720   744     0   744   432     0  78      \_ login -h 207.173.16
 1251  p0    163    114   264   412   676     0   676   536     0  35          \_ -bash
 1263  p0    128     71    16   696   712     0   712   416     0  74              \_ su
 1264  p0    151     87   256   444   700     0   700   528     0  43                  \_ bash
 1271  p0     88     26    28   384   412     0   412   320     0  23                      \_ ps
  110  ?      23     22    32   368   400     0   400   308     0  23 syslogd
  130  ?      16   1561    24   388   412     0   412   316     0  24 crond
  119  ?      67     51    28   488   516     0   516   304     0  53 klogd
  312   1    237     79    24   696   720     0   720   416     0  76 /bin/login -- jake
  318   1    193    114   264   408   672     0   672   532     0  35  \_ -bash
  335   1    131     70    16   676   692     0   692   400     0  73      \_ su
  339   1    156    254   260   432   692     0   692   516     0  44          \_ bash
  187  ?      12  35244   200   556   756     0   756   688     0  51 sendmail: accepting connect
 1269  ?       6     25   220   572   792     0   792   720     0  54  \_ sendmail: server [207.1
 1270  ?      12     38   248   632   880     0   880   732     0  64      \_ sendmail: LAA01270
  294  ?      32   6819   168   700   868     0   868   792     0  74 httpd
 1233  ?       0     19   168   700   868     0   868   792     0  74  \_ httpd
 1169  ?      13     51   204   768   972     0   972   772     0  87  \_ httpd
 1170  ?      13     54   204   768   972     0   972   772     0  87  \_ httpd
 1171  ?      13     53   204   768   972     0   972   776     0  87  \_ httpd
  619  ?      17     94   204   772   976     0   976   764     0  88  \_ httpd
 1157  ?      15     68   204   772   976     0   976   764     0  88  \_ httpd
  944  ?      13     59   204   772   976     0   976   772     0  88  \_ httpd
 1167  ?      13     59   204   772   976     0   976   768     0  88  \_ httpd
 1168  ?      13     57   204   772   976     0   976   776     0  88  \_ httpd
  214  ?      15     95   204   780   984     0   984   760     0  90  \_ httpd
  171  ?      28    747   160  1956  2116     0  2116   468     0 412 named

Notice there is nowhere near 98 MB ram in use.  So whats using the rest of the memory?  I don't have any ramdisks mounted, and no ramdisks initialized in the kernel.  Shouldn't bdflush kick in and clear this (it never does)?  How can I get more efficient memory usage?  How can I clear the memory without resetting the box?

Mike Crist
mike@mwaz.com  
0
Comment
Question by:MikeCrist
4 Comments
 
LVL 2

Expert Comment

by:n3mtr
ID: 1628934
What does the free program tell you?
Its prabably being used for a disk cache, and resetting would actually hurt your performance.
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 1628935
What do mean by:
> .. all of the memory is in use.
and later:
> Notice there is nowhere near 98 MB ram in use.

Have you checked in /var/log/boot.msg if the kernel detecet your 98Mb RAM?
0
 
LVL 3

Accepted Solution

by:
sauron earned 200 total points
ID: 1628936
What you're saying is that the sum of memory used by your processes is nowhere near your 96Megs of RAM. When you have loads of spare memory, any disk read gets read into the disk cache. The disk cache will keep on growing as long as there is free memory, and will shrink when a process requests a memory block from the system. The free command should show that most of your memory is in use for cache. This is a good thing - all your memory is being used to enhance system performance.

Things like this are only bad if they cause swapping - MS products are awful at this, they swap like crazy, and performance sucks. Linux won't swap unless you push it, but it will fill up all available memory with cache. Also, the kernel doesn't usually see memory above 64 Megs, the total memory shown in the output from free will show you how much memory the kernel has. You may well need to add a 'mem=96M' parameter to your lilo.conf, or loadlin command line.
0
 
LVL 1

Author Comment

by:MikeCrist
ID: 1628937
I didn't know that the memory was already allocated to cache.  Yes, I do have the MEM statement in lilo.conf,  and free shows something like:
             total       used       free     shared    buffers     cached
Mem:         95392      93908       1484      16112      57996      19324
-/+ buffers:            16588      78804
Swap:        24092          0      24092

So memory will be allocated to programs and from cache as needed?

Mike Crist
mike@mwaz.com
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Little introduction about CP: CP is a command on linux that use to copy files and folder from one location to another location. Example usage of CP as follow: cp /myfoder /pathto/destination/folder/ cp abc.tar.gz /pathto/destination/folder/ab…
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now