[LLVMdev] Prevent unbounded memory consuption of long lived JIT processes

José Fonseca jfonseca at vmware.com
Wed Mar 16 06:23:34 PDT 2011


On Tue, 2011-03-15 at 18:39 -0700, NAKAMURA Takumi wrote:
> Good morning Jose,
> 
> Thank you to send patches.
> 
>   - Please send patches to llvm-commits.
>   - Please make patches with "--attach". You may add "format.attach"
> to git config.

Will do, thanks.

> I have not seen yours yet, but I pushed yours to github;
> https://github.com/chapuni/LLVM/compare/ed4edf9e...jfonseca%2F20110316
> (Excuse me I could not input accent)
> 
> ...Takumi

Nice. I haven't used github yet, but I'll try using it going forward.

Jose

> 
> On Wed, Mar 16, 2011 at 8:15 AM,  <jfonseca at vmware.com> wrote:
> > This series of patches address several issues causing memory usage to grow
> > indefinetely on a long lived process.
> >
> > These are not convenional leaks -- memory would have been freed when the LLVM
> > context or/and JIT engine is destroyed -- but for as long as they aren't the
> > memory is usage effectively ubounded.
> >
> > 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.





More information about the llvm-dev mailing list