Virtual memory exhausted

Testing out some Boost preprocessor library changes, for which I am the maintainer, with g++8 using Travis CI in the Ubuntu xenial distribution I get an error saying:

virtual memory exhausted: Cannot allocate memory

Is this coming from the OS or g++ ? Testing this out on my own system in Ubuntu there is no problem. How much virtual memory do I get with Travis CI ? Can I change my testing environment to give me more virtual memory ? It is really hard to believe that that the code, which exercises the gcc preprocessor, is actually running out of virtual memory.

The URL is https://travis-ci.org/github/boostorg/preprocessor/jobs/728647110.

Hello @eldiener,

Looked over your .travis.yml file, have you tried adding:

script:
   - make -j 1 test

See if that makes any difference at all?

1 Like

Is the advice setting -j 1, or setting -j to the number of CPUs ( how do I know that number ? ) , or setting -j$(nproc) where the nproc variable may be the number of CPUs for all I know? So what should I set -j to in order to possibly avoid the out of memory conditions? I agree that setting -j to an arbitrary number like 3 is wrong.

The advice is:

  1. In Travis’ case, setting -j to anything more than 2 (all Travis VMs are 2-core) has no positive effect in any case.
  2. Set it to 1 to see if reducing the number of jobs is sufficient or you will have to resort to something else. If it works, try 2.
1 Like
Imprint