[LLVMdev] memory hog llvm-ld

Holger Schurig hs4233 at mail.mn-solutions.de
Wed Jul 18 04:44:55 PDT 2007


I want to share a little LLVM experiment.


I tried LLVM on one of my bigger Qt 3.x based projects. I used 
llvm from SVN trunk (r39999) and SVN llvm-gcc-4.01 (r370) and 
did compile every file with

  /usr/src/llvm/dist/bin/g++ -c -pipe -g \
  -Wall -Wextra -Wno-sign-compare \
  ... lots of -Dxxxx ... \
  --emit-llvm -I/usr/share/qt3/mkspecs/default \
  -I. -I.. -I../../../include/qt3 -I.obj/ \
  -o .obj/FILENAME.o FILENAME.cpp

so that I later had 211 .o files, all in the binary bytecode 
format. I tried it that way because I thought that then the 
possibilities for inter-process and inter-module optimizations 
are probably the highest.

Note that I did specify "-g", but not any "-Ox" switches. That 
made the size of all *.o files together being 143 MB.


Now, I tried to link this. I used this command line:

  /usr/src/llvm/dist/bin/llvm-ld -v -stats -native
  -o main -L/usr/share/qt3/lib -L/usr/X11R6/lib \
  -lcrypto -lusb -lutil -lqt-mt -lXext -lX11 -lm -lpthrea

used a tremendous amount of memory. My system swapped heavily. 
After about a minute, I issued a "top" command and saw:

   VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
   454m 423m  904 R 27.8 84.2   1:06.51 llvm-ld

I then stopped llvm-ld, because I didn't know how my OOM memory 
killer would behave :-)



More information about the llvm-dev mailing list