You are not logged in.

#1 2013-01-16 20:58:00

blackout23
Member
Registered: 2011-11-16
Posts: 780

Runnig out of memory on /tmp while comiling [Solved]

Hello,

I want to compile mysql-workbench but run into memory issues. My laptop has 2 GB of RAM. 64 GB SSD with one ext4 partition. I created a 2 GB swapfile on /.

This is df -lh

rootfs           59G     12G   45G   21% /
dev             959M       0  959M    0% /dev
run             970M    636K  969M    1% /run
/dev/sda1        59G     12G   45G   21% /
tmpfs           970M    628K  969M    1% /dev/shm
tmpfs           970M       0  970M    0% /sys/fs/cgroup
tmpfs           970M     16K  970M    1% /tmp

RAM keeps filling up from 500 MB to 1.1 GB then falls back to 500 MB. When reaching 1.2 GB it swaps some MB into the swapfile. Swappiness is at 30. That goes one for over a hour untill the build fails with some out of memory messages.

I looked into df -lh again and saw that /tmp was maxed out at 100%.

This is /etc/fstab:

#
# /etc/fstab: static file system information
#
# <file system> <dir>   <type>  <options>       <dump>  <pass>
tmpfs           /tmp    tmpfs   nodev,nosuid    0       0
/swapfile       none    swap    defaults        0       0
# UUID=2985462a-ac9c-48de-8bbf-0bbb83a4b4f3
/dev/sda1               /               ext4            rw,relatime,data=ordered        0 1

I read the wiki that /tmp can be increased to more than 50% of physical memory with the size option but I'm not sure if that is a good idea.

Anyone has some ideas that would help me out?

Last edited by blackout23 (2013-01-17 20:59:05)

Offline

#2 2013-01-16 21:05:24

lucke
Member
From: Poland
Registered: 2004-11-30
Posts: 4,018

Re: Runnig out of memory on /tmp while comiling [Solved]

Are you using packer or somesuch? packer by default uses /tmp for building packages. If you compile outside of /tmp, files used while compiling won't be forcefully kept in your memory.

Offline

#3 2013-01-16 21:09:44

blackout23
Member
Registered: 2011-11-16
Posts: 780

Re: Runnig out of memory on /tmp while comiling [Solved]

I simply let the PKGBUILD do it's thing. Compiling it via AUR. Really not sure what tools and parameters it uses. I did not change anything in that regard on my Arch system.

Last edited by blackout23 (2013-01-16 21:10:45)

Offline

#4 2013-01-16 21:18:31

lucke
Member
From: Poland
Registered: 2004-11-30
Posts: 4,018

Re: Runnig out of memory on /tmp while comiling [Solved]

Maybe you have BUILDDIR set to /tmp in makepkg.conf?

Offline

#5 2013-01-16 21:30:48

blackout23
Member
Registered: 2011-11-16
Posts: 780

Re: Runnig out of memory on /tmp while comiling [Solved]

Builddir is actually commented out with # in /etc/makepkg.conf and refers to /tmp/makepkg
Would changing it to my homedirectory solve the problem?

Offline

#6 2013-01-16 21:45:27

lucke
Member
From: Poland
Registered: 2004-11-30
Posts: 4,018

Re: Runnig out of memory on /tmp while comiling [Solved]

If it's commented out, building should be done in the directory PKGBUILD is in. You could run makepkg and see what's growing in /tmp with "du -hs /tmp*". If you can't move it out of /tmp, then you could (temporarily) make /tmp use the disk, not RAM - if you're not using systemd, comment out /tmp in fstab and reboot; if you're using systemd, you'd probably (additionally?) need to disable the unit mounting /tmp as tmpfs or somesuch.

Offline

#7 2013-01-17 18:07:00

slytux
Member
From: New York
Registered: 2010-09-25
Posts: 107

Re: Runnig out of memory on /tmp while comiling [Solved]

By default, /tmp defaults to half your RAM if mounted in tmpfs.  You can increase it to possibly 1.5Gb using the size=1536M mount option although you may still get OOM errors if your system uses more than the remaining if the compile fillls it up.  You can also change the compile path to your ~

Offline

#8 2013-01-17 20:00:53

graysky
Member
From: /run/user/1000
Registered: 2008-12-01
Posts: 8,523
Website

Re: Runnig out of memory on /tmp while comiling [Solved]

2 G might not be enough.  As others have pointed out, tmp is 1/2 physical by default.  Do you know how large the package you want to build is on disk with source and tmp files from make, etc?  I'm guess >1 G.  If you want to compile in RAM, consider adding more to the machine.  If you cannot or will not, compile on disk.


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#9 2013-01-17 20:57:52

blackout23
Member
Registered: 2011-11-16
Posts: 780

Re: Runnig out of memory on /tmp while comiling [Solved]

Yes I'll just have to compile it on the disk. Obviously commenting something out in /etc/fstab out is not enought I'd also have to "sudo systemctl mask tmp.mount".  Did not have time for this as of yet. Thanks for all your contribution!

2 GB is the RAM limit on my laptop motherboard. For 99,9% of my other tasks the laptop is more than adequat and fast enough.

Last edited by blackout23 (2013-01-17 20:58:05)

Offline

Board footer

Powered by FluxBB