Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mention TMPFS As Possible RAM Sink #10

Open
Enverex opened this issue Mar 9, 2018 · 1 comment
Open

Mention TMPFS As Possible RAM Sink #10

Enverex opened this issue Mar 9, 2018 · 1 comment

Comments

@Enverex
Copy link

Enverex commented Mar 9, 2018

So I just spent a good while trying to figure out why I was missing ~700MB+ of RAM and wasn't having any luck. Annoyingly almost every forum post or StackOverflow post would scream "it's buffers+cache!" or point users to this website, even when the user posting had clearly taken those figures into account. None of these posts were useful, it was just the same comments parroted over and over.

My situation was this: The RSS field of "ps aux" summed came to around 230MB at worst. Free completely disagreed with this:

 free -m
              total        used        free      shared  buff/cache   available
Mem:           7746         323        6686         647         737        6598
Swap:          8165          24        8141

Even adding up the fields in TOP came nowhere close to what free was claiming. The "323 used" in free was close, but why are free and available showing a deficit of over 1GB?

The answer, was tmpfs. For anyone unfamiliar, tmpfs is used to making RAM disks. Virtual media where the data is stored in RAM. On most distros, the /tmp folder of the system is a RAM disk.

Anyway, sure enough, there was a nearly 650MB file in the /tmp folder which accounted for most of this missing RAM. Once deleted, I now see...

free -m
              total        used        free      shared  buff/cache   available
Mem:           7746         323        7331           9          92        7239
Swap:          8165          12        8153

(ignore the buff/cache change, I dropped caches between runs which is why that suddenly changed)
The 323MB used reported by free still doesn't match up with the 220MB used I'm seeing by summing the RSS field of "ps aux", but at least it's a lot closer now.

TL;DR: Missing RAM? Check your RAM disk(s).

@Snuggle
Copy link

Snuggle commented Mar 9, 2018

This confused me for a while. My old package manager used to build everything in /tmp, which caused almost all of my memory to be used by the tmpfs and kept getting OutOfMemory errors everywhere, but htop only showed ~1.5 GB used total. I was very confused.

After changing my package manager's build directory to ~/Temporary/build, I no-longer had any issues. 😸

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants