Sorry, but my previous answer was totally wrong.
For Containers, we read the values from /sys/fs/cgroup/CTID/ (memory.stat and memory.current).
This is because container memory is limited by the cgroup kernel system.
Tools like "free" or "btop" use kernel syscalls, which simple return the...