How to deal with OOM when load

Hi hacker,
I met a problem when i dlopen for use, but our memory is limited, so we met an abort at

#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1  0x00007f10bde19859 in __GI_abort () at abort.c:79
#2  0x00007f109c24cc33 in llvm::report_bad_alloc_error(char const*, bool) () from /lib/x86_64-linux-gnu/
#3  0x00007f109c23dc32 in ?? () from /lib/x86_64-linux-gnu/
#4  0x00007f109c23dd6c in ?? () from /lib/x86_64-linux-gnu/
#5  0x00007f109c2312db in llvm::cl::Option::addArgument() () from /lib/x86_64-linux-gnu/
#6  0x00007f109c18c08e in ?? () from /lib/x86_64-linux-gnu/
#N dlopen stack.

Platform : Ubuntu 20.04. x86_64 Linux 5.15.0-52-generic

I want to ask help for :

  1. If there is a better way to use the BadAllocErrorHandler to prevent abort and let the
    user to decide how to deal with OOM when we load the library?
  2. What does addArgument do after finish mmap the llvmlib?