[llvm-dev] MCJit and remove module memory leak?
koffie drinker via llvm-dev
llvm-dev at lists.llvm.org
Fri Oct 28 04:10:23 PDT 2016
I'm on llvm 3.8.1 and was wondering if there's a memory leak in the
removeModule impl of mcjit.
In the tutorial http://llvm.org/releases/3.8.1/docs/tutorial/LangImpl4.html
a module is removed from the Jit by invoking removeModule.
According to the tutorial:
"Its API is very simple:: addModule adds an LLVM IR module to the JIT,
making its functions available for execution; removeModule removes a
module, freeing any memory associated with the code in that module;"
But when I look into the implementation of remove module, it only erases
the ptr from AddedModules
//return AddedModules.erase(M) || LoadedModules.erase(M) ||
FinalizedModules.erase(M);
When you add a module, the unique ptr is stripped, and the raw ptr is
stored.
//AddedModules.insert(M.release());
This should imply that the person who is invoking removeModule also should
invoke a delete on the ptr?
Am I missing something here?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20161028/2e4e8d7c/attachment.html>
More information about the llvm-dev
mailing list