0

enter image description here

Attach is the screenshot of htop program. The memory usage always increase, but I could not find what program is eating my RAM. Afterwards, only 200MB memory left free :'(.

Could you give me some hints to fix this problem?

Update:

I stop all the processes I know (in fact there is only one process I ran), wait about 30 minutes and do

free -m total used free shared buffers cached Mem: 15039 14687 352 0 1 16 -/+ buffers/cache: 14669 370 Swap: 0 0 0

It seems to me that the memory free space will never come back.

Update 2

ps aux --sort -rss | head USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND root 1060 0.0 0.0 279756 3320 ? Sl 15:11 0:00 /usr/lib/policykit-1/polkitd --no-debug ubuntu 1830 0.0 0.0 21808 3240 pts/1 Ss 15:12 0:00 -bash root 751 0.0 0.0 10220 2296 ? Ss 15:11 0:00 dhclient -1 -v -pf /run/dhclient.eth0.pid -lf /var/lib/dhcp/dhclient.eth0.leases eth0 root 1054 0.0 0.0 344384 2264 ? Ssl 15:11 0:00 NetworkManager root 1 0.1 0.0 33760 2072 ? Ss 15:11 0:03 /sbin/init root 1327 0.0 0.0 287352 1712 ? Sl 15:11 0:00 /usr/lib/accountsservice/accounts-daemon ubuntu 20475 0.0 0.0 17324 1424 pts/1 R+ 15:48 0:00 ps aux --sort -rss syslog 942 0.0 0.0 262132 1328 ? Ssl 15:11 0:00 rsyslogd root 530 0.0 0.0 51928 1268 ? Ss 15:11 0:00 /lib/systemd/systemd-udevd --daemon ** Update 3: **

Results of sudo slabtop

1

2 Answers 2

1

A good way is to check the processes with the largest RSS

ps aux --sort -rss | head

..or use tools such as slabtop to see where memory is being used on the Linux slab allocator:

sudo slabtop
4
  • I added the result of your command above. I do not find any process which consume a lot of CPU or RAM, but free -m still say that I have only about 300MB left May 20, 2016 at 15:50
  • Yeah, I added the result of sudo slabtop too. It seems not understandable for me May 20, 2016 at 15:55
  • There are a lot of kmalloc-32 slabs being used up there, I wonder if this is a memory leak in the kernel. May 20, 2016 at 17:27
  • It seems there was a kernel bug with kmalloc-32: lists.debian.org/debian-kernel/2012/07/msg00619.html . But that was back in 2012. That can't still be in 14.04, could it?
    – Ray
    May 24, 2016 at 2:33
1

Your memory is probably being used as a RAM disk (https://en.wikipedia.org/wiki/RAM_drive).

Type df -h. Do you see a "tmpfs" that is mounted on either /dev/shm or /run/shm? If so, that is your memory being used for that file system.

In the past, I have stored frequently accessed files there (Note: the files are deleted when you reboot). I don't remember the details about it, but it supposedly adjusts in size as you use memory. However, I always wondered if I left a file there, whether it will never reclaim that space. Thus, I gave up doing this.

If you search on this site for words like "RAM disk", /dev/shm, or /run/shm (the last one is the location used by older versions of Ubuntu), you will find more information. See for example:

Or this from another site:

(I hope this answers your question about where your memory went. However, my suggestion is to leave it alone at its default size until you read up more about it. I don't remember whether the system relies on it.)

3
  • Hello @Ray, thanks a lot. Actually I don't mind a lot, but when the memory is full, OOM Killer started to kill my applications :( May 23, 2016 at 8:25
  • @kid_2901 Well, if the problem was OOM Killer, you probably should have said that in your original message. Your original concern was the amount of RAM being used up, wasn't it? If it's the OOM Killer, what error messages do you get when it kicks in, what are you running when it kicks in, etc. Is it always the same program you're running, etc. A single program can allocate a huge chunk of memory and use it up just when it's starting up.
    – Ray
    May 24, 2016 at 2:40
  • Also, I don't know if this applies to Ubuntu but oracle.com/technetwork/articles/servers-storage-dev/… gives some suggestions on guiding what it kills.
    – Ray
    May 24, 2016 at 2:42

You must log in to answer this question.

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