1

I'm aware that the kernel uses memory for caches, but that that memory is available to user applications on demand. In claiming that memory is "missing" I am refering to the "available" memory in the output of free, which takes this into account

As I see it, if you kill all the processes you startes, you should get back to the available memory you had, more or less. That doesn't seem to be the case, though.

Here's the output of free -k immediately after logging in to X, with a minimalist WM and just a couple of shells and things:

after reboot:

              total        used        free      shared  buff/cache   available
Mem:        8144232      373664     6945832        1644      824736     7514692

available is at 7.5MiB, all good.

After the using the computer for a couple of weeks, the available memory drops significantly, and stays below where it started even if I kill all the applications I started. If I kill every application I can find, I may get the "available" up to about 5GiB.

Then if I restart the display manager and login again, I get:

              total        used        free      shared  buff/cache   available
Mem:        8144344      577280     5547936      982600     2019128     6279136
Swap:             0           0           0

Which does release more of of the memory than simply killing applications, but requires me to reopen everything again. Moreover, this doesn't get me near the 7.5GiB of a fresh startup. I see that the shared memory usage accounts for the majority of that, but seeing as I've already shut down every user process, I don't understand why it's so high.

I'd like to know what causes this behaviour, and if there's a solution for it, preferably one that doesn't require me to reboot my machine, or restart X.

3
  • Possible memory leak. Aug 1, 2020 at 15:39
  • @IporSircer, I would think so yes. Aug 2, 2020 at 8:12
  • @waltinator, anything more specific? ps is a complex command, what procedure did you have in mind? Aug 2, 2020 at 8:13

1 Answer 1

1

free shows a high value for "shared" and that swap is disabled. If /tmp is mounted as a tmpfs, any files there are actually stored in shared memory and with no swap, the system cannot swap them to free up memory.

Check with df and see how much space is used in /tmp, that might account for the difference you're seeing between application memory and total system memory.

You must log in to answer this question.

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