I seem to have about 10Gb of shared memory consumed, I believe by a process that I terminated with ctrl-C.

$ free -h
              total        used        free      shared  buff/cache   available
Mem:           31Gi       706Mi       1.9Gi        10Gi        28Gi        19Gi
Swap:         4.0Gi       4.0Gi          0B

Here's the output of htop, sorted on % memory use:

enter image description here

There do not seem to be any processes that can account for this. I definitely had a memory intensive program running at one point, but as mention I killed it. I'd like to run it again, but it's now unable to run because of memory issues. In addition, I checked

$ ipcs -a --human

------ Message Queues --------
key        msqid      owner      perms      size         messages

------ Shared Memory Segments --------
key        shmid      owner      perms      size       nattch     status
0x00000000 13         kevin      600            4M     2          dest
0x00000000 48         kevin      600            4M     2          dest
0x00000000 49         kevin      600           64M     2          dest

------ Semaphore Arrays --------
key        semid      owner      perms      nsems


I can reboot the system of course, but it's a server at work, and I don't always have physical access to start it back up. Is there a way to force that memory to be freed?

  • 1
    tmpfs (eg mounted on /tmp also /run /run/user/* etc.) uses shared memory – A.B Feb 8 at 12:31

You may try:

echo 3 > /proc/sys/vm/drop_caches

This will clear system buffer and cache. Better if done when server is not under heavy workload.

| improve this answer | |
  • I tried this a bit earlier based on some other posts here and didn't notice any change :-(. – kevbonham Feb 8 at 1:57
  • What kind of job does this server do? Webserver? – realpclaudio Feb 8 at 1:59
  • No, it's a linux desktop I use for scientific computing, but I usually ssh in from my mac – kevbonham Feb 8 at 15:04
  • Did you tune some kernel parameters? That swap usage with plenty of ram still available is strange too. – realpclaudio Feb 8 at 20:59
  • I didn't (at least, I don't think I did). If it makes a difference, it's running Pop!_os (which I think is mostly Ubuntu). But this is my first real experience with running a linux OS, so I've avoided messing about with anything low level. – kevbonham Feb 10 at 14:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.