Enormous memory usage of clang

Hi all,

I've found case when clang consumes much more memory that GCC (maybe it's a memory leak)

Attachement is preprocessed translation unit from amalgamated Botan library.

clang++ -c -O0 botan.ii # OK
clang++ -c -O2 botan.ii # Memory usage reaches 1Gb and continues to grow
clang++ -S -emit-llvm -O2 botan.i # OK
llc -O2 botan.s # OK

botan.ii.bz2 (418 KB)

What clang version are you using? What target?

I just tried 159724 on linux x86-64 and "clang++ -c -O2 botan.ii"
peaks at about 366 MB.

More importantly - How was it built and with which compiler? -O0, -O2 with and or without asserts and Debugging info.. etc

Please try clang++ -c -O2 -g botan.ii (previous revision of clang leaked memory without -g too, but it doesn't reproduce on latest trunk)

I'm using clang trunk (r159913), linux x86-64, built with clang++ -O2

on X86_64, clang++ takes more time to compile also.
I am using the clang 3.0 release version.

Please try clang++ -c -O2 -g botan.ii (previous revision of clang leaked memory without -g too, but it doesn't reproduce on latest trunk)

I'm using clang trunk (r159913), linux x86-64, built with clang++ -O2

I get:

-O2 -g -c: about 1gb
-O2 -g -S: about 900 mb
-O3 -g -c -emit-llvm: about 800 mb

So this looks like a different bug from what you found originally, it
is "just" that our debug representation is very not very memory
efficient, but gcc 4.7 peaks at about 850 mb, so we are not that bad.

Cheers,
Rafael