gcc behavior on memory exhaustion
Andrew Roberts
andrewm.roberts@sky.com
Wed Aug 9 13:50:00 GMT 2017
On 09/08/17 14:05, Andrew Roberts wrote:
> I routinely build the weekly snapshots and RC's, on x64, arm and aarch64.
>
> The last gcc 8 snapshot and the two recent 7.2 RC's have failed to
> build on aarch64 (Raspberry Pi 3, running Arch Linux ARM). I have
> finally traced this to the system running out of memory. I guess a
> recent kernel update had changed the memory page size and the swap
> file was no longer being used because the page sizes didn't match.
>
> Obviously this is my issue, but the error's I was getting from gcc did
> not help. I was getting ICE's, thus:
>
> /usr/local/gcc/bin/g++ -Wall -Wextra -Wno-ignored-qualifiers
> -Wno-sign-compare -Wno-write-strings -std=c++14 -pipe -march=armv8-a
> -mcpu=cortex-a53 -mtune=cortex-a53 -ftree-vectorize -O3
> -DUNAME_S=\"linux\" -DUNAME_M=\"aarch64\" -DOSMESA=1 -I../libs/include
> -DRASPBERRY_PI -I/usr/include/freetype2 -I/usr/include/harfbuzz
> -I/usr/include/unicode -c -o glerr.o glerr.cpp
> {standard input}: Assembler messages:
> {standard input}: Warning: end of file not at end of a line; newline
> inserted
> {standard input}:204: Error: operand 1 must be an integer register --
> `mov'
> {standard input}: Error: open CFI at the end of file; missing
> .cfi_endproc directive
> g++: internal compiler error: Killed (program cc1plus)
> Please submit a full bug report,
> with preprocessed source if appropriate.
> See <https://gcc.gnu.org/bugs/> for instructions.
> make: *** [<builtin>: glerr.o] Error 4
> make: *** Waiting for unfinished jobs....
>
> I was seeing the problem when building using make -j2. Both building
> gcc and building large user projects.
>
> There are two issues here:
>
> 1) There was discussion about increasing the amount of memory gcc
> would reserve to help speed up compilation of large source files, I
> wondered if this could be a factor.
>
> 2) It would be nice to see some sort of out of memory error, rather
> than just an ICE.
>
> The system has 858Mb of RAM without the swap file.
>
> Building a single source file seems to use up to 97% of the available
> memory (for a 2522 line C++ source file).
>
> make -j2 is enough to cause the failure.
>
> Regards
>
> Andrew Roberts
>
For what its worth, if I disable the swap on a 32 bit Raspberry Pi3
(armv7l), with 936Kb free memory, building my project with make -j4,
only uses 33% of the memory, and does not ICE.
So there seems a huge memory usage regression for aarch64 vs arm. Nearly
3x the memory usage is more than you would expect by doubling pointer
sizes. Does aarch64 use a different default preallocation of memory?
Regards
Andrew
More information about the Gcc
mailing list