Active5 years ago
One more question about memory on Solaris 10.
Memory is one of the most important parts of your Unix system for performance. Let's look at some commands that will tell you what you need to know about the memory on the systems you manage is. How can I delete all not used semaphores and shared memory with a single command on a UNIX-like system, e.g., Ubuntu?
A top shows me that I have 672 MB free memory :
A vmstat shows me the same :
But when I do a prstat -a -s size I get this :
and as you can see, the sum of RSS values does not reach 15GB of memory, and even if I add SWAP values to it.
So my question is : which command do I believe ?
If top and vmstat give me the good result, where are my 15GB used memory ?If not, why do they show me that ?
Edit:the result for the command :
% echo ::memstat | mdb -k
Edit 2:
Ok, now i can see the memory used by ARC cache.
But with some new tests, now I have :
But with some new tests, now I have :
2066 MB used
(prstat -Z and echo ::memstat | mdb -k result)1193 MB free
(top result)8859 MB ARC cache
(kstat zfs::arcstats:size result) Which give us more or less
Maybe I missed something else, but where are the other
12 GB
of memory, while my system has 16 GB
.Maybe I missed something else, but where are the other
4 GB
?Jeremy C.
Jeremy C.Jeremy C.1481 gold badge2 silver badges10 bronze badges
![Ipcs Command To Find And Remove The Zombie Ram Heap Ipcs Command To Find And Remove The Zombie Ram Heap](http://1.bp.blogspot.com/_L1QrHboT9_c/SzeWv3qs1zI/AAAAAAAAARg/39Hbsd49UrI/s320/34958FP00_w.jpg)
2 Answers
ZFS is likely using most of your memory as ARC cache. Should you want to know how your RAM is used, run this command as root:
![Sysresv Sysresv](https://s2.manualzz.com/store/data/043052138_1-b1d193c80f2f253a25a66b302e36f868.png)
On Solaris 10 10/09 and newer, this displays something like this:
As you see, there is a line stating how much of the RAM is used to cache ZFS file data. Unfortunately, you are running an older Solaris 10 release so memstat doesn't show this ZFS statistic separately. It is included with the Kernel used memory which is confusing. A kernel shouldn't use 13 GB of RAM under normal circumstances.
Anyway, there is still a way to display the full ARC size on your server.
Just run this command:
It shows that on my machine, 273 MB of RAM are currently used to handle the ZFS ARC cache. memstat shows that from these 273 MB, 208 MB are used as file cache. Up to these 208 MB of RAM could be released automatically on demand should applications need it.
Now lets look at processes memory usage. If you use the -Z option with prstat, it shows a summary per zone under the per process statistics. Here the global (and only) zone is using 185 MB of RAM. This should (roughly) match the sum of all processes rss column.
These 185 MB correspond to sum of two lines in memstat output: 'Anon' which is RAM used by applications to store data and 'Exec and libs' which is the applications and their libraries code.
jlliagrejlliagre
The memory is filled with unmapped pages of data read from disk. It's kept in memory because those files may be read again and keeping the data in memory saves a disk read. Free memory is forever wasted, so the computer tries to keep as little of it as possible.
For example, say you run a program. The program terminates. The program is still in memory, but those pages of memory are not used by any process since the program isn't running. If the system isn't under memory pressure, the pages are kept in memory. If the program runs again, this will save the effort of making it free just to have to allocate more memory for the program and then read it in again. And if the pages are needed for something else, it's still a win for the system because it's easier to move a page of memory directly from use to another than make it free only to make it used again.
Memory is not a saveable resource. If you leave 1GB free for an hour, anything you could have done with that data is forever lost.
David SchwartzDavid Schwartz29.1k1 gold badge46 silver badges74 bronze badges