[PATCH] D26216: [MCJIT] Remove eventListeners when MCJIT is destructed

Lang Hames via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 1 16:49:32 PDT 2016


lhames added a comment.

Hi Anna,

Thanks for looking into this.

The ExecutionEngine::RegisterEventListener documentation specifies that the JIT does not take ownership of the event listener, so freeing the listener is the client's responsibility.

The usual idiom is to allocate the listener as a local variable (if the JIT is used in a single function) or member variable (if the JIT is a class member), then register it. That way the listener is freed with the JIT. If any clients are heap allocating listeners and not freeing them that's definitely a bug.

Cheers,
Lang.


https://reviews.llvm.org/D26216





More information about the llvm-commits mailing list