Arch uses systemd (the controversial init system that has caused lots of debates, but I have personally loved it), and since the upcoming 15.04 version, Ubuntu will use it too.
And systemd by default mounts the /tmp directory files using a tmpfs, which is mounted on RAM, limited by default to half the physical available memory. Also, in my installation (don't know if this is Arch's or Antergos' default), the /etc/fstab file also had the /tmp to be mounted as tmpfs.
This might be nice for most people, but if you run applications that store huge amounts of data in /tmp, it can be terrible.
In my case it is GWT which writes hundreds of megabytes to the temporary folder.
- Eclipse uses1.0-1.5GB of RAM
- The GWT SuperDevMode, together with the running application, takes another 1.0-1.5GB
- Chrome uses 1.0-2.0GB of RAM with several open tabs (and when dev tools is open, it eats a lot of RAM too)
At least I found that I can improve things by disabling mounting /tmp as tmpfs.
To do that I've resorted, as usual, to the excellent Arch Wiki (by the way, one of the best pieces of documentation for any project I've ever seen): https://wiki.archlinux.org/index.php/Tmpfs.
I have removed the line in /etc/fstab which declares /tmp as tmpfs and created the /etc/tmpfiles.d/tmp.conf file with the following content:
# see tmpfiles.d(5) # always enable /tmp folder cleaning D! /tmp 1777 root root 0 # remove files in /var/tmp older than 10 days D /var/tmp 1777 root root 10d # namespace mountpoints (PrivateTmp=yes) are excluded from removal x /tmp/systemd-private-* x /var/tmp/systemd-private-* X /tmp/systemd-private-*/tmp X /var/tmp/systemd-private-*/tmp
Then we need to tell systemd to not mount /tmp as tmpfs automatically, with the following command:
systemctl mask tmp.mount
Afterwards, just rebooted the system and.... magic! I can nicely work with GWT compilation again.
As Ubuntu 15.04 will switch to systemd, and systemd by default mounts /tmp as tmpfs even without anything defined in /etc/fstab, this might affect Ubuntu too in the future. The same is true to other major distributions.