LLJIT running out of memory when addIRModule is called in WASM

I’m trying to run LLJIT in wasm, I compiled it with emscripten. I was able to produce LLVM IR, but as soon as I’m trying to add the ThreadSafeModule, ExitOnErr(llvmJit->addIRModule(std::move(threadSafeModule))); it runs out of memory.

This is completely absurd, that almost 2.8GB are requested, since I’m only running the same module from the example.

Do you guys have any ideas, why this could happen or any ideas how to debug this and find the cause of it?

Cannot enlarge memory, requested 2880614400 bytes, but the limit is 2147483648 bytes!

Cannot enlarge memory, requested 2880618496 bytes, but the limit is 2147483648 bytes!

LLVM ERROR: out of memory

Allocation failed

Aborted(native code called abort())

myLib.js:681 Uncaught RuntimeError: Aborted(native code called abort())
    at abort (myLib.js:675:11)
    at _abort (myLib.js:4543:7)
    at myLib.wasm.llvm::report_bad_alloc_error(char const*, bool) (myLib.wasm:0x352e3)
    at myLib.wasm.llvm::SmallVectorBase<unsigned int>::grow_pod(void*, unsigned long, unsigned long) (myLib.wasm:0x35485)
    at myLib.wasm.llvm::DataLayout::operator=(llvm::DataLayout const&) (myLib.wasm:0x18d28f)
    at myLib.wasm.llvm::Module::setDataLayout(llvm::DataLayout const&) (myLib.wasm:0x18cf60)
    at myLib.wasm.llvm::orc::LLJIT::applyDataLayout(llvm::Module&) (myLib.wasm:0x108b8b3)
    at myLib.wasm.llvm::orc::LLJIT::addIRModule(llvm::IntrusiveRefCntPtr<llvm::orc::ResourceTracker>, llvm::orc::ThreadSafeModule) (myLib.wasm:0x108b75a)
    at myLib.wasm.llvm::orc::LLJIT::addIRModule(llvm::orc::JITDylib&, llvm::orc::ThreadSafeModule) (myLib.wasm:0x108baec)
    at myLib.wasm.ng::JitContext::addModule(std::__2::shared_ptr<ng::GeneratorContext>) (myLib.wasm:0x109f66f)