[LLVMdev] [PATCH 1/5] Prevent infinite growth of the DenseMap.

José Fonseca jfonseca at vmware.com
Tue Mar 15 16:20:31 PDT 2011


git-send-mail was supposed to send a summary for the patch series, but
it didn't made it somehow. Here it is:


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.



Jose




More information about the llvm-dev mailing list