Lowering Compiz memory usage
I have been following the updates that appear every week in how they affect the performance and resource usage of Compiz since I installed 11.10 (Right now I am testing 12.04 and 14.04). For what I have seen, the CPU and memory usage have lowered (specially memory). I am comparing installing 12.04/14.04 without any updates and then applying all updates and also comparing 12.04 to 14.04. For example nautilus is using less than 35 MB (For me it was between 70 MB and 150 MB doing the same activities with it several versions ago).
Other processes have also received some kind of optimizations which have lowered my total memory usage from around 850 MB to 610 MB (I also use services like Apache, MySQL, etc..) but after all of this time, the only one that has stayed almost the same is Compiz. It still uses more than 100MB to start. Only using the desktop with Unity and no other programs running, it takes (right now) 133 MB. What options can I use to lower the memory footprint WITHOUT compromising the stability of Unity (For example removing the OpenGL plugin from Compiz config is a BAD idea).
What optimizations can be done to lower the memory usage of Compiz?
NOTE - I have Compiz Config Settings Manager (CCSM) installed already.
A work around to the compiz memory leak is to:
sudo kill -HUP <compiz_process_id>
Not a great solution, but it frees up leaked memory without completely killing the process.
It is rather difficult in my experience to lower the Compiz memory usage. The best thing I can suggest to lower the texture quality in the OpenGL plugin, but this won't change much afaik.
Another source of compiz memory increases can be memory leaks. This seems to sometimes be triggered by indicators, but can be from other sources as well (not sure of them yet).
My solution as been to periodically restart unity, using a simple script that contains:
#kill compiz completely, including all child processes, freeing it's memory:
killall -9 compiz &
#run unity and give you back a free terminal.
unity & disown
I know this isn't the best of answers, so I'm following this question myself to see if anyone has better tips.
I know this is an old post, but Gus's answer helped me and I'd like to add to it. This is what I did (on Ubuntu 12.04):
- Alt+F2 (run application)
- Scheduled Tasks
- New recurrent task
killall compiz -HUP
- Every day at 00:00
Now compiz will be restarted automatically every night, without having to know the process id.
My problem was that if I left my screen locked for a few days, it took ~30 seconds to open the screen lock, and compiz memory usage was around 1000 MB.