| Summary: | `free' command doesn't show amount of cached memory | ||
|---|---|---|---|
| Product: | Busybox | Reporter: | Andrey Batyiev <generatorglukoff> |
| Component: | Other | Assignee: | unassigned |
| Status: | RESOLVED FIXED | ||
| Severity: | minor | CC: | busybox-cvs, craig+busybox |
| Priority: | P5 | ||
| Version: | 1.16.x | ||
| Target Milestone: | --- | ||
| Hardware: | Other | ||
| OS: | Linux | ||
| Host: | Target: | ||
| Build: | |||
Here is how free from procps-3.2.8 works:
# free -V
procps version 3.2.8
# free
total used free shared buffers cached
Mem: 2056744 568524 1488220 0 24768 233968
-/+ buffers/cache: 309788 1746956
Swap: 4128760 0 4128760
# ls -lR >/dev/null
# free
total used free shared buffers cached
Mem: 2056744 932140 1124604 0 148656 233956
-/+ buffers/cache: 549528 1507216
Swap: 4128760 0 4128760
Semi-cryptic "-/+ buffers/cache:" line means: used and free, corrected for (buffers + cached).
For reference, bbox on the same machine shows:
# busybox free
total used free shared buffers
Mem: 2056744 931140 1125604 0 148672
Swap: 4128760 0 4128760
Total: 6185504 931140 5254364
It's a little misleading to say this is "fixed". It still doesn't show a "cached" column, and doesn't adjust the 2nd line ("-/+ buffers") by the amount of cache.
I've just been caught out by this myself -- trying to debug memory consumption in an embedded system, and being thrown off by some large file reads using up significant amount of kernel file cache.
|
Typical busybox `free' command output is: # free total used free shared buffers Mem: 13480 8944 4536 0 968 Swap: 0 0 0 Total: 13480 8944 4536 # which says that almost 2/3 of RAM is used. However: # cat /proc/meminfo | grep Cached Cached: 4272 kB SwapCached: 0 kB # so in fact there is 4Mb in cache, and that means there is 9Mb usable memory (free+cached+buffers). And this means it's only 1/3 of RAM is used. That's confusing. It would be nice to see amount of cached memory as well as standard line '-/+ buffers/cache:'.