This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: g++ trouble with empty initialiser list for big std::array
- From: Mason <slash dot tmp at free dot fr>
- To: Sergiu Ivanov <sivanov at colimite dot fr>
- Cc: Nicolas Glade <nicolas dot glade at imag dot fr>, GCC help <gcc-help at gcc dot gnu dot org>, Jonathan Wakely <jwakely dot gcc at gmail dot com>
- Date: Mon, 9 Jan 2017 16:29:57 +0100
- Subject: Re: g++ trouble with empty initialiser list for big std::array
- Authentication-results: sourceware.org; auth=none
- References: <87vatp2wam.fsf@colimite.fr> <7a6eee16-40ef-8e9a-4886-37c5861ea696@free.fr> <87pojw2u2k.fsf@colimite.fr>
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.