Hi, I am working on a binary translator and use LLVM for this. In the process, I generate millions of constants (immediate values in the source binary code). The problem is that these constants seem to be not cleaned when I delete the LLVM code (using Function::deleteBody() ) and as a result the memory usage keeps growing. I browsed the forum and found that constants "live forever" by design. Is there are simple way of cleaning the used memory without destroying everything (unloading the ExecutionEngine, freeing the module, calling llvm_shutdown) ? Ideally I would like something which brings everything to the state just after I created the JIT engine for the first time. Thanks, Vitaly C. -- View this message in context: http://www.nabble.com/Reducing-LLVM%27s-memory-usage-tp21174014p21174014.html Sent from the LLVM - Dev mailing list archive at Nabble.com.
Hi Vitaly, Vitaly C. wrote:> Hi, > > I am working on a binary translator and use LLVM for this. > In the process, I generate millions of constants (immediate values in the > source binary code). > The problem is that these constants seem to be not cleaned when I delete the > LLVM code (using Function::deleteBody() ) and as a result the memory usage > keeps growing. I browsed the forum and found that constants "live forever" > by design. >Right.> Is there are simple way of cleaning the used memory without destroying > everything (unloading the ExecutionEngine, freeing the module, calling > llvm_shutdown) ? Ideally I would like something which brings everything to > the state just after I created the JIT engine for the first time. > >+1 :) Being on the JIT side also, that would be a great feature. I know there is a plan to support parallel compilation between LLVM modules, and this may involve a self-sufficient module (ie constants, types will be deleted at deletion of the module), but I don't know what's the status of the project. Nicolas
Hi Vitaly C. wrote:> > Is there are simple way of cleaning the used memory without destroying > everything (unloading the ExecutionEngine, freeing the module, calling > llvm_shutdown) ? Ideally I would like something which brings everything to > the state just after I created the JIT engine for the first time. >I've tried to run the Fibonacci example with Valgrind after having added delete EE and llvm_shutdown in the main of fibonacci.cpp. Unfortunately, it gives me a lot of definitely lost blocks. I also have similar problems with my own code: there is a lot of lost ConstantInts. From what I saw in the LLVM code, constants are put in a statically managed structure which is supposed to be cleaned at shutdown. Vitaly C. -- View this message in context: http://www.nabble.com/Reducing-LLVM%27s-memory-usage-tp21174014p21242672.html Sent from the LLVM - Dev mailing list archive at Nabble.com.
>> Is there are simple way of cleaning the used memory without destroying >> everything (unloading the ExecutionEngine, freeing the module, calling >> llvm_shutdown) ? Ideally I would like something which brings everything >> to >> the state just after I created the JIT engine for the first time. >> > > I've tried to run the Fibonacci example with Valgrind after having added > delete EE and llvm_shutdown in the main of fibonacci.cpp. Unfortunately, > it > gives me a lot of definitely lost blocks. > I also have similar problems with my own code: there is a lot of lost > ConstantInts. From what I saw in the LLVM code, constants are put in a > statically managed structure which is supposed to be cleaned at shutdown.The leakage of Constant* is a known issue. In attach I send a fairly complete suppression file for valgrind (use with --suppressions=valgrind.supp) that will suppress the known problems from the report. Nuno -------------- next part -------------- A non-text attachment was scrubbed... Name: valgrind.supp Type: application/octet-stream Size: 1943 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20090101/006c5976/attachment.obj>