Re: GCC compilation performance under RAM starvation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi!

On Fri, Jun 27, 2025 at 10:54:28AM +0000, Krystian Kazmierczak (Nokia) wrote:
> Not sure whether missing swap is the root cause, when I replace gcc by simple python script where memory is continuously allocated in loop using bytearray(256) I observe that OOM killer is invoked regularly, each time when we hit memory limit. Container is not "hanged" and OOM killer behaves as expected killing python script one by one.

The OOM killer is a huge swath of heuristics.  Heuristics behave
heuristically.

There is no obvious "best thing to do" when OoM.  There are heuristics
on what process to kill (first), hoping that this will allow the user
to productively continue.  Killing processes unexpectedly will always
be disruptive though!

The linux memory management stuff works a lot better if there is swap.
Perhaps this is because of history, in the very old days most systems
had way to little RAM, nowadays you just need some reasonable amount of
money to get more RAM, but long ago all bigger systems needeed a lot of
swap space to run at all.

So all the mechanisms for that became well tuned over time.  Ans, there
are esssentially *no* good tunings for systems without swap: if they run
out of available RAM, things start to die.  And always the things you
expect least (or want to die least).

It is easiest for yourself if you do the same thing everyone else does,
and has done for the last three decades: just add some swap space.  Even
a swap file is often enough, if you're in a pinch :-)

GCC is not special at all here btw, it just is one of the processes that
use a lot of memory that many people encounter before others.


Segher



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux