5

I am using lxd to run multiple containers and having trouble reporting the memory usage: both htop and free shows high memory usage but the list of processes that uses memory is very short and doesn't add up to the reported usage.

From the bare metal this is what htop shows (sorted by %MEM, userland threads hidden): htop screen

This is top (sorted by %MEM): top screen

And this is free -mh:

              total        used        free      shared  buff/cache   available
Mem:            15G        8.2G        5.5G        576M        1.6G        5.4G
Swap:            9G        297M        9.7G

From the htop screenshot I would expect the total memory used to be around 2G+ (adding the RES value), not 10G+. From Why does the memory usage in "top" not add up?, the reported "really used" memory is still ~6.6G.

Am I missing something, is the displayed memory reporting coherent?

2
  • Are these results from inside the container?
    – Attie
    Jul 9, 2018 at 13:41
  • The results are from outside the container, from the bare metal. I can see the processes inside all the containers being reported in that view.
    – user60177
    Jul 10, 2018 at 13:57

2 Answers 2

1

I think the memory reporting may be correct.

top shows the first 22 processes, and claims there are 789 total. About 1900MB of the 6.6G is accounted for by those which are shown, leaving about 4897 MB for the other 767 processes. That leads to an average of just over 6 MB per process for all the rest. Do you have reason to believe that's not possible? Without knowing what kind of processes they are, I'm not sure how to estimate their memory use, other than < 14.5 MB.

1

If your entire OS is running in a virtualized environment (like VMWare), this may be result of memory ballooning.

To check ballooned memory, install the open-vm-tools package and run:

$ vmware-toolbox-cmd stat balloon
5172 MB

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .