[Techtalk] RAM usage
jdike at karaya.com
Wed Aug 15 00:05:48 EST 2001
subba9 at home.com said:
> Although quite a lot of user have more memory, it looks like most
> memory is being used up. Is there anyway to flush the RAM of apps that
> have been closed? Last but least, how can I use RAM disks for
> particular applications (or is it a function of kernel only?)?
The general answer is "don't worry, be happy" :-)
The kernel will try to use as much memory as it possibly can for anything
that's the slightest bit useful. Any unused memory is just being wasted.
So, you'll tend to see a small amount of free memory (cat /proc/meminfo),
with a fair amount in buffers and caches. That's fine. If you run a memory
hog (i.e. netscape, oink oink), that memory will be freed to make room for
The memory of exited processes is freed automatically at exit time. What's
not freed immediately is data in files (including the executable itself and
libraries) that it had been accessing. Those will tend to stick around for
a while on the theory that they may be used again by someone running that
process again. If not, then that stuff will be aged out to disk.
As far as ramdisks go, I think the idea is that you mount a tmpfs filesystem
where you want it to be mounted (usually /tmp, hence the name), and anything
that creates files in that filesystem will get them in the in-memory
I don't see that this is generally useful. If a particular app is a heavy
user of /tmp and its performance depends on the performance of /tmp, then
you ought to try this and see.
If you really want to be on the bleeding edge, you can get the latest -ac
kernel, which has Al Viro's namespaces in it. These essentially are process
private mounts, so if you had an app which needed tmpfs, you could give it
a /tmp that no other process could see that had a tmpfs mounted on it.
More information about the Techtalk