On 09/01/2017 15:20, Sergiu Ivanov wrote: > Mason wrote: > >> I use the Compiler Explorer to quickly test new versions. >> >> https://godbolt.org/ >> >> I can reproduce your issue on 5.4 > > [...] > >> I tried running on my system, which started thrashing, so I'm assuming >> gcc is trying to allocate too much memory, and gets zapped by the OOM >> ninja? > > Thanks for testing! Now I know it's not only my computers :-) > > Not sure about the actual reason for this behaviour. When the C++ standard reaches a million pages, maybe the universe will implode? :-) Here's an interesting (?) observation. If I limit the compiler to 512 MB of memory, it errors out after a few seconds: $ ulimit -v 512000 $ time g++ -std=c++11 bug.cpp virtual memory exhausted: Cannot allocate memory real 0m5.088s user 0m4.757s sys 0m0.326s If I limit the compiler to 1024 MB of memory, it takes a while before it gets zapped. The cc1plus process quickly allocates 900 MB RES, then slowly adds more. $ ulimit -v 1024000 $ time g++ -std=c++11 bug.cpp virtual memory exhausted: Cannot allocate memory real 17m46.360s user 17m43.767s sys 0m1.008s Potential candidates (?) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56671 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68203 Regards.