[llvm-commits] Prevent unbounded memory consuption of long lived JIT processes

jfonseca at vmware.com jfonseca at vmware.com
Thu Mar 24 07:30:33 PDT 2011


This series of patches address several issues causing memory usage to grow
indefinitely on a long lived process.

These are not conventional leaks -- memory will be freed when the LLVM context
or/and JIT engine is destroyed -- but for as long as they aren't the memory is
usage effectively unbounded.

The issues were found using valgrind with '--show-reachable=yes' option: 
1. Compile a bunch of functions with JIT once; delete the result; and exit
   without destroying LLVM context nor JIT engine. (valgrind will report a
   bunch of unfreed LLVM objects)
2. Do as 1, but compile and delete the functions twice 
3. Ditto three times.
4. Etc.

Flawless code should not cause the memory usage to increase when compiling the
same -- ie valgrind's log for every run should show the very same unfreed
objects, regardless of the number of times a given code was compilation, but
that was not the case. The attached patches cover most of the causes for new
objects being allocated.

It should be possible to automate such test, but I didn't get that far.

I've ran the nightly tests, and there was no regression, nor significant trend
of GCCAS column time.





More information about the llvm-commits mailing list