Tiny Core Base > TCB Q&A Forum

Physical RAM Usage

(1/1)

SamK:
What is the best way to determine the amount of physical RAM that is currently being used on a given machine?

On this PC it is reported as follows:

Via free:

* Mem Total 514896K Used 137132K
* Swap Total 369344K Used 0
Via top:

* Mem Used 137236K
Via htop:

* Mem Total 502MB Used 47MB
* Swap Total 360MB Used 0
EDIT
I decided to repeat the tests in a clean environment as follows:
Booted TC in cloud mode
Boot options: base norestore noswap
Installed htop

Reports:
Via free:

* Mem Total 514916K Used 33380K
* Swap Total 128720K Used 0
Via top:

* Mem Used 33400K
Via htop:

* Mem Total 502MB Used 15MB
* Swap Total 125MB Used 0

Does the compressed swap in RAM in TC3 affect the reports?  Does the option noswap affect the compressed swap in RAM? What is the amount of physical RAM used?
 

curaga:
free & top do report all ram that's in use, but a part of it is caches that can be freed as necessary. These are not included in htop's number.

There are two things mixing things up a bit with regards to the caches, TC being in tmpfs (cache that can't be freed), and the compressed swap (takes ram, but less than the "swap used" number says; can be freed once there is free ram).

So if you want the exact hard number, use htop's + ~ 18mb (tinycore.gz unpacked) + ~(used ramzswap/2).
Plus any files stored in ram, such as browser settings and extensions in cloud mode.
There's a script to free all freeable caches, after which the number of free and top is correct:

--- Quote ---sudo cache-clear
--- End quote ---



--- Quote ---Does the option noswap affect the compressed swap in RAM?
--- End quote ---

No, it's usually desired even when the disk swap is unwanted. The embed code also disables ramzswap currently.

SamK:
Thanks for the swift reply curaga.

If I understand correctly the easiest way to determine the RAM usage (in TC terms) is using cache-clear plus either free or top.

I am considering extending life of old thin-client machines by re-tasking as an appliance type device based on the local installation of TC and apps.  Some of these devices have memory modules soldered to the motherboard making them almost impossible to upgrade.  Knowing in advance the RAM required for a particular TC thin-client device is desirable.


--- Quote from: curaga on July 25, 2010, 03:17:46 AM ---So if you want the exact hard number, use htop's + ~ 18mb (tinycore.gz unpacked) + ~(used ramzswap/2).
Plus any files stored in ram, such as browser settings and extensions in cloud mode.

--- End quote ---
OK, I would like to learn a little more here.  I understand " ~ 18mb (tinycore.gz unpacked)."

Please will you expand further on these:


--- Quote from: curaga on July 25, 2010, 03:17:46 AM ---...+ ~(used ramzswap/2).

--- End quote ---
Is this the amount of swap reported by top divided by 2? Or is the default compressed swap always a fixed size (i.e 128MB) making the calculation [total amount of swap reported by top minus 128MB] divided by 2?


--- Quote from: curaga on July 25, 2010, 03:17:46 AM ---Plus any files stored in ram, such as browser settings and extensions in cloud mode.

--- End quote ---
How is this obtained/calculated?
 

curaga:

--- Quote from: SamK on July 25, 2010, 04:18:01 AM ---If I understand correctly the easiest way to determine the RAM usage (in TC terms) is using cache-clear plus either free or top.

--- End quote ---

Yes


--- Quote ---
--- Quote from: curaga on July 25, 2010, 03:17:46 AM ---...+ ~(used ramzswap/2).

--- End quote ---
Is this the amount of swap reported by top divided by 2? Or is the default compressed swap always a fixed size (i.e 128MB) making the calculation [total amount of swap reported by top minus 128MB] divided by 2?

--- End quote ---

Amount of used swap in the ramzswap device, they can be seen per-device in /proc/swaps. Divide by 2 is an estimation of the zlib compression used. Size of the compressed swap is 25% of ram by default.


--- Quote ---
--- Quote from: curaga on July 25, 2010, 03:17:46 AM ---Plus any files stored in ram, such as browser settings and extensions in cloud mode.

--- End quote ---
How is this obtained/calculated?

--- End quote ---

du -hs /home
du -hs /tmp/tce

Of course the first goes away with a persistent home, and the second with a tce dir.

tinypoodle:
to determine RAM size used as storage you can do:

--- Quote ---df |grep tmpfs

--- End quote ---
so by deducting this number from total mem usage you get mem usage minus file storage (always after an instantly preceeding <sudo cache-clear>). If i understand right, tmpfs usage gets accounted
as cached mem(?)

The most detailed output of mem use is given by

--- Quote ---cat /proc/meminfo

--- End quote ---

Another aspect to take into consideration might be Slab allocation which can gradually increase with system activity since last boot

Navigation

[0] Message Index

Go to full version