4

I'm working with a fresh install of OpenBSD (5.6 amd64). I'm attempting to build Boost libraries, and quite a few compilations are failing with cc1plus running out of memory errors.

I've read elsewhere that increasing swap can solve this problem. However, for me that's not working. Currently I have 4 gig of swap set up. However, none of it is even being used. Swapctl always shows

total: 8390592 512-blocks allocated, 0 used, 8390592 available

Even while the compiles fail, this remains the same.

There's something unusual about my install I should mention. It's installed on a USB stick, and I've used full disk encryption via the softraid0 method. So my /dev/sd1b is my 4g of swap, /dev/sd1a is raid, /dev/sd2 (the encrypted raid) is partitioned as normal by the installer, except no swap there.

My question is why is my swap space not being used at all, even as the compiler runs out of memory?

2
  • I don't know about openBSD, but in gentoo linux this error means there is not enough space in /var. I suppose it will be the same in BSD. my computer never uses swap, so mounting the 4g at /var would probably solve your problem.
    – switch87
    Commented Nov 17, 2014 at 16:48
  • Interesting. I've been focused on swap, because of some other threads I've seen. I'll experiment with /var when I get back to that machine, later tonight.
    – Dave Cohen
    Commented Nov 17, 2014 at 18:09

2 Answers 2

5

By default OpenBSD doesn't allow processes to use infinite memory. These limits are defined in /etc/login.conf.

If you hit those limits, you'll get an out of memory error even though the OS as a whole still has plenty left. Most of the time this is nice, since one rogue process won't be able to suck up all memory and bring the system to its knees. Sometimes, however, it gets in the way. Fortunately you can change it.

1
  • 1
    Great call. I got past the memory issue with sudo -E -c daemon ... Unfortunately I still have compilation errors to deal with. BTW, just asking this question shows my OpenBSD rookie status. The answer is right in the FAQ: openbsd.org/faq/obsd-faq.txt
    – Dave Cohen
    Commented Nov 19, 2014 at 7:05
1

You may also gain some traction by adding yourself to the staff group. The memory limits for that group seem to be set more generously than for other classes of user.

You must log in to answer this question.

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