0

I notice my available memory going down to zero (from 12GB) when compiling a project including a header-only library (tiny-dnn). Following this is a system freeze. This seems to mostly occur when there is a compilation or a linker error (especially linker error). This occurs with swap on or off.

Are there techniques to use memory more efficiently or maybe use less recursion or something.

I'm using gcc7+default linker of ubuntu14.04 (haven't checked, but will tomorrow) and CMake + Ninja build tools. Maybe there are some useful compile or link flags to use? Assume I'm using the bare minimum at this point. Maybe switching to clang compiler or gold linker will help?

errolflynn
  • 641
  • 2
  • 11
  • 24
  • Yes, We were facing similar issue at my office with ninja + cmake, gcc 7 + default linker used to be very slow. then we moved to clang now it is far better. – yadhu Jul 20 '18 at 05:37
  • I had some success by using the gold linker when building a large project (clang) because it uses less memory. Also check whether you can limit the number of parallel link steps in your build. As a first step you could try building with -j1. If this works it may pay off to limit parallel linking if the linker is indeed the problem. You could also try the build with limits on process memory in place (ulimit) to find out if a single process is the main culprit wasting the memory. – PaulR Jul 20 '18 at 12:01
  • Yes I'm facing the same issue. Wondering if I can architect the code better, but using `make -- -j 1` for the moment, which avoids the system hang when it runs out of memory, by limiting the amount of memory being used. – Alex Jan 22 '21 at 22:50

0 Answers0