vvaltchev/tilck

Memory leak in compiled GCC.

mxlgv opened this issue · 6 comments

mxlgv commented

Builded the toolchain with a script. Changed it a bit to use pacman for my Artix Linux. The toolchain is builded and the package is installed. However, when the kernel compilation hits 53 percent, I run out of memory and Xorg killed.

Hello :-) I've observed the same kind of problem while building any big-enough project on machines which a low amount of usable memory. Simply, by using make -j, GNU make spawns as many GCC instances as possible and each one consumes a fair amount of memory (hundreds of MBs): at some point, your system runs out of memory and the OOM killer is run: it selects a process to kill according to a complex system of heuristics. In your case, it chose Xorg. That has nothing to do with Tilck, nor it's build system or GCC. And it's definitively not a memory leak.

Therefore, if you don't have enough RAM, just build with make or at most make -j2. Limit the level of parallelization.

mxlgv commented

Thank you! I've just never encountered it. Sorry.

Suddenly have almost the same on the build with make -j (Ubuntu freezes, hard reboot). The log shows zero free swap space. Moved to the simple make :-)

@duselguy how much RAM do you have? try at least make -j2

@vvaltchev
4GB RAM and 2GB swap. At the build time with make -j I had Chrome opened with GitHub tab. It looks like Chrome failed (something like oops on Chrome page appeared + warnings about Chrome extensions crashes). Ok, but what I don't like is Ubuntu freezing (keyboard and mouse are blocked) at out of memory.

Unfortunately, that's pretty much inevitable because of the way the whole software stack is built (it's complicated). I don't like that we (the software industry) ended up in this position. For other operating systems is more or less the same. Just, the swap might dynamically expand on the fly but, if it reaches its hard limit, the whole system will loose stability because doesn't know which process must be killed.

Anyway, the easiest solution is to just increase the size of the swap or to get more RAM.