So X.org is allocating an insane amount of RAM: right now 910MB (according to the RES
column in htop), second only to Firefox (really Nightly) (at just over 1GB) and trailed by GNOME Shell (at only 256MB). I searched online for ways to force X to free leaked memory, and what I found suggested using xrestop to spot the cause. The problem is that xrestop is saying this:
xrestop - Display: localhost
Monitoring 24 clients. XErrors: 0
Pixmaps: 21876K total, Other: 519K total, All: 22396K total
This clearly says that X resources are only accounting for a whopping 22MB. The other software I'm running at this time are Liferea, Konversation, and gnome-terminal with several tabs open.
You might think that Firefox is causing this, but no: if I kill that, X.org's memory stays high: now at 957MB, minutes after I initially wrote this question, and xrestop switches to
xrestop - Display: localhost
Monitoring 23 clients. XErrors: 0
Pixmaps: 9975K total, Other: 504K total, All: 10480K total
instead!
Now all the Google hits I found for X memory leaks that actually post xrestop output shows that the problem is clearly in resource allocation; these answers all have resource usage that nears the total RAM usage of X.org. But this isn't the case here.
Bug reports I've found are a) from 2009 b) inconclusive.
What's going on and how can I free all that extra RAM without restarting X? I'd rather not have to load my session (active chats, terminal tabs) over again.
Ubuntu GNOME 14.10
fglrx-updates 2:14.201-0ubuntu2 installed via Additional Drivers
Lenovo G50-45
AMD A6-6310 APU with AMD Radeon R4 Graphics
I technically have 4GB of RAM, but htop only says 3221MB is available and free -m
says (while Firefox is still running)
total used free shared buffers cached
Mem: 3221 3087 133 5 6 125
-/+ buffers/cache: 2955 265
Swap: 7812 2662 5150
My system has been up for 12 days and 4 hours now, and in that time I've also run the acme text editor, fceux, empathy, some sgt-puzzles games, and possibly other programs.
Thanks.
UPDATE 31 January 2015
top -n 1
output from a few minutes ago (4:04 AM, shortly after a slowdown streak):
top - 04:04:19 up 14 days, 9:00, 9 users, load average: 1.98, 2.17, 2.06
Tasks: 414 total, 2 running, 410 sleeping, 2 stopped, 0 zombie
%Cpu(s): 10.6 us, 2.0 sy, 0.0 ni, 85.9 id, 1.2 wa, 0.0 hi, 0.2 si, 0.0 st
KiB Mem: 3298800 total, 3119652 used, 179148 free, 18796 buffers
KiB Swap: 8000508 total, 3067288 used, 4933220 free. 208568 cached Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
17722 pietro 20 0 2672276 1.264g 38596 R 80.3 40.2 136:03.00 firefox-tr+
1767 root 20 0 3267084 780500 79680 S 17.2 23.7 1168:42 Xorg
17302 pietro 20 0 2122240 275544 52684 S 17.2 8.4 90:48.53 gnome-shell
25038 pietro 20 0 29280 3064 2368 R 11.5 0.1 0:00.04 top
1 root 20 0 29584 920 776 S 0.0 0.0 0:09.45 init
2 root 20 0 0 0 0 S 0.0 0.0 0:00.60 kthreadd
3 root 20 0 0 0 0 S 0.0 0.0 0:21.44 ksoftirqd/0
5 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/0:+
7 root 20 0 0 0 0 S 0.0 0.0 31:41.83 rcu_sched
8 root 20 0 0 0 0 S 0.0 0.0 6:56.03 rcuos/0
9 root 20 0 0 0 0 S 0.0 0.0 6:51.16 rcuos/1
10 root 20 0 0 0 0 S 0.0 0.0 6:45.78 rcuos/2
11 root 20 0 0 0 0 S 0.0 0.0 10:45.32 rcuos/3
12 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcu_bh
13 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcuob/0
14 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcuob/1
15 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcuob/2
top -n 1
output from just now (4:18-ish AM, during another one):
top - 04:19:08 up 14 days, 9:15, 9 users, load average: 2.22, 2.04, 1.98
Tasks: 416 total, 1 running, 413 sleeping, 2 stopped, 0 zombie
%Cpu(s): 10.6 us, 2.0 sy, 0.0 ni, 85.9 id, 1.2 wa, 0.0 hi, 0.2 si, 0.0 st
KiB Mem: 3298800 total, 3105312 used, 193488 free, 8220 buffers
KiB Swap: 8000508 total, 3064824 used, 4935684 free. 149000 cached Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
17722 pietro 20 0 2745204 1.298g 30852 S 75.2 41.3 141:50.42 firefox-tr+
17302 pietro 20 0 2122624 217428 47028 S 11.6 6.6 93:07.81 gnome-shell
25183 pietro 20 0 29280 3152 2456 R 11.6 0.1 0:00.04 top
14792 pietro 20 0 166024 752 752 S 5.8 0.0 0:03.54 plumber
1 root 20 0 29584 916 776 S 0.0 0.0 0:09.45 init
2 root 20 0 0 0 0 S 0.0 0.0 0:00.60 kthreadd
3 root 20 0 0 0 0 S 0.0 0.0 0:21.45 ksoftirqd/0
5 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/0:+
7 root 20 0 0 0 0 S 0.0 0.0 31:43.49 rcu_sched
8 root 20 0 0 0 0 S 0.0 0.0 6:56.52 rcuos/0
9 root 20 0 0 0 0 S 0.0 0.0 6:51.66 rcuos/1
10 root 20 0 0 0 0 S 0.0 0.0 6:46.29 rcuos/2
11 root 20 0 0 0 0 S 0.0 0.0 10:46.09 rcuos/3
12 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcu_bh
13 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcuob/0
14 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcuob/1
15 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcuob/2
And one more, also just now (4:20 AM):
top - 04:20:59 up 14 days, 9:17, 9 users, load average: 2.20, 2.09, 2.00
Tasks: 416 total, 2 running, 412 sleeping, 2 stopped, 0 zombie
%Cpu(s): 10.6 us, 2.0 sy, 0.0 ni, 85.9 id, 1.2 wa, 0.0 hi, 0.2 si, 0.0 st
KiB Mem: 3298800 total, 3102064 used, 196736 free, 7196 buffers
KiB Swap: 8000508 total, 3042968 used, 4957540 free. 137692 cached Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
17302 pietro 20 0 2122688 217972 47528 S 16.8 6.6 93:23.58 gnome-shell
17722 pietro 20 0 2765140 1.289g 36856 R 16.8 41.0 142:46.71 firefox-tr+
25197 pietro 20 0 29280 3136 2444 R 11.2 0.1 0:00.05 top
25200 pietro 20 0 233480 9448 8316 S 11.2 0.3 0:00.02 gpaste
9 root 20 0 0 0 0 S 5.6 0.0 6:51.72 rcuos/1
1767 root 20 0 3260868 858068 73568 S 5.6 26.0 1169:44 Xorg
1 root 20 0 29584 872 776 S 0.0 0.0 0:09.45 init
2 root 20 0 0 0 0 S 0.0 0.0 0:00.60 kthreadd
3 root 20 0 0 0 0 S 0.0 0.0 0:21.46 ksoftirqd/0
5 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/0:+
7 root 20 0 0 0 0 S 0.0 0.0 31:43.72 rcu_sched
8 root 20 0 0 0 0 S 0.0 0.0 6:56.58 rcuos/0
10 root 20 0 0 0 0 S 0.0 0.0 6:46.34 rcuos/2
11 root 20 0 0 0 0 S 0.0 0.0 10:46.21 rcuos/3
12 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcu_bh
13 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcuob/0
14 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcuob/1
(as requested by Fabby below)
UPDATE 5 February 2015
Wait, something's not right: I restarted my computer two days ago and in that time X.org has only allocated 254MB, not 900+ MB...??? xrestop says only 30MB is used. Would graphics drivers only require fixed amounts of RAM?
RES
column of htop (which I'm pretty sure I pointed out above). I figured integrated graphics might have had to do with the RAM difference (given that came up in search results/related questions suggestions as well), but I didn't think it would be that much (unless I don't actually have 4GB...)dmidecode
confirms that I indeed have 4GB of RAM.