Memory leaks in the JIT and how will MC-objects be deallocated in the MCJIT?

We are currently using the JIT (non-MC) to implement a REPL-like shell that
needs to run in a long-lived process. During development, we noticed
substantial memory-growth with increased lifetime of the JIT.

In trying to eliminate that continuous memory growth, we did a few things,
including making LLVMContext collect and free unused constants (detected by
Value::uses_empty()). This dropped the memory growth by half.

Now we notice that the JIT allocates temporary symbols used by
codegeneration in the MCContext's BumpPtrAllocator and never frees it. So
after a certain amount of iterations in the shell's REPL loop, we will run
out of memory for sure.

Hence I was thinking of introducing a second BumpPtrAllocator into the
MCContext that is used for all symbols starting with the private global asm
prefix. After a function has been jitted, that allocator is cleared,
allowing to stop the infinite growth of symbols memory. The assumption is
that those symbols are only needed during generation of a functions' code.

But when I looked into the MCJIT, I noticed that this approach won't work
for it, because it uses AsmPrinter, which will create MC abstraction objects
like MCBinaryExpr, that are all allocated into the BumpPtrAllocator of the
MCContext. It seems to me that's a major source of memory growth in the
MCJIT, because that memory cannot be released anymore.

So I have two questions:

1. Is the approach I took to stop memory growth for the non-MC JIT alright?
Or are there any problems with this?

2. Is the potential infinite memory growth in the MCJIT known? Is there an
easy solution?

I'm glad for any help. Thanks!