@aktau This callback pattern is common in libraries and is something I have
planned. Git's xmalloc dies on OOM, but provides setters for routines that
can free application memory and other routines that are called when OOM is
unrecoverable.

There should be many such configurable callbacks once neovim becomes a lib.