<html dir="ltr"><head></head><body style="text-align:left; direction:ltr;"><div>See below for replies:</div><div><br></div><div>On Mon, 2019-09-23 at 12:16 -0700, Rajesh S R via llvm-dev wrote:</div><blockquote type="cite" style="margin:0 0 0 .8ex; border-left:2px #729fcf solid;padding-left:1ex"><div dir="ltr">Hi all,<div>I am using LLVM for JIT use-case and compile functions on the fly. I want to "free" the modules after some time and reclaim any memory associated with it. I am using the <a href="https://llvm.org/docs/tutorial/BuildingAJIT1.html">SimpleORC API</a> now. </div><div>Is there an API to "free" all the memory associated with the module? I use one "compiler" instance (think similar to KaleidoscopeJIT class with its ExecutionSession, CompileLayer etc.) in my process. </div></div></blockquote><div><br></div><div>AFAIK the memory associated with JIT compiled code is owned by the ExecutionSession from which you obtained the JITEvaluatedSymbol and is initially allocated by the ObjectLayer using a SectionMemoryManager. </div><div><br></div><blockquote type="cite" style="margin:0 0 0 .8ex; border-left:2px #729fcf solid;padding-left:1ex"><div dir="ltr"><div><br></div><div>Is there an API to reset all memory used? Does deleting the "KaleidoscopeJIT" class ensure all memory is reclaimed? In that case i can periodically re-create that class to achieve what i want.</div></div></blockquote><div><br></div><div>Beyond running the destructor for either the ExecutionSession or ObjectLayer, I have not seen a way to do this. Perhaps it's possible by implementing your own SectionMemoryManager-like class?</div><div><br></div><blockquote type="cite" style="margin:0 0 0 .8ex; border-left:2px #729fcf solid;padding-left:1ex"><div dir="ltr"><div><br></div><div>Thanks!</div><div><br></div><div>Rajesh S R</div></div>
<pre>_______________________________________________</pre><pre>LLVM Developers mailing list</pre><pre><a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a></pre><pre><a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a></pre><pre><br></pre></blockquote></body></html>