https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70599
Ambroz Bizjak <ambrop7 at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |ambrop7 at gmail dot com --- Comment #4 from Ambroz Bizjak <ambrop7 at gmail dot com> --- Hi, (I'm the author of Aprinter) I find that with -g1 instead of -g, the compile works fine. I've managed to refactor the code so that gcc compiles it with -g, using up to 8.5 GiB. The resulting .elf file is 627M (with -g1 16M, without -g 437K). It takes gdb about a minute to load the full file, and memory use of gdb grows to gigabytes. I suspect that the issue with -g is that gcc includes ALL types in the output, including types used only for metaprogramming. Probably for every list like Cons<1, Cons<2, Cons<3>>> there will be a quadratic explosion all constituent lists are included as symbols in the output, which is very bad for non-trivial lists. Clang manages to compile the same thing (with -g) using 1GiB RAM and results in a 181M .elf output.