Reduce memory usage in boost build

I am trying to create a C ++ library on a Linux system with limited memory resources using g ++ 4.6. The library uses Boost heavily.

I've seen various topics here and on other websites regarding compilation speed, but I'm interested in tips and tricks to make g ++ less memory intensive, even if that means you are losing speed.

EDIT: I tried using precompiled headers for Boost, which improves build speed but requires about the same amount of memory.

+6
source share
1 answer

You need to play with the garbage collector settings. The ggc-min-expand and ggc-min-heapsize . Also set ulimit to ulimit 65536 (or something else) to reduce the heap size (RLIMIT_AS).

Lots of info on this in the gcc manual here

A good setting would be to set the ggc-min-expand parameter to 0 and ggc-min-heapsize param for 8192 and try with this ...

CXXFLAGS = "$ (CXXFLAGS) --param ggc-min-expand = 0 --param ggc-min-heapsize = 8192" or some such value.

+5
source

Source: https://habr.com/ru/post/944270/


All Articles