summaryrefslogtreecommitdiff
path: root/src/backend/jit/llvm
diff options
context:
space:
mode:
authorHeikki Linnakangas2023-07-05 10:13:13 +0000
committerHeikki Linnakangas2023-07-05 10:13:13 +0000
commit4f4d73466d71976b58f29121bab9d9fef6f3436e (patch)
tree1735f70e91c9bbd2c980ef82048f536948450dd7 /src/backend/jit/llvm
parent088539015173a204839a53d1d0fc8fa8c96783ba (diff)
Fix leak of LLVM "fatal-on-oom" section counter.
llvm_release_context() called llvm_enter_fatal_on_oom(), but was missing the corresponding llvm_leave_fatal_on_oom() call. As a result, if JIT was used at all, we were almost always in the "fatal-on-oom" state. It only makes a difference if you use an extension written in C++, and run out of memory in a C++ 'new' call. In that case, you would get a PostgreSQL FATAL error, instead of the default behavior of throwing a C++ exception. Back-patch to all supported versions. Reviewed-by: Daniel Gustafsson Discussion: https://www.postgresql.org/message-id/[email protected]
Diffstat (limited to 'src/backend/jit/llvm')
-rw-r--r--src/backend/jit/llvm/llvmjit.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/backend/jit/llvm/llvmjit.c b/src/backend/jit/llvm/llvmjit.c
index 04ae3052a82..5c30494fa17 100644
--- a/src/backend/jit/llvm/llvmjit.c
+++ b/src/backend/jit/llvm/llvmjit.c
@@ -221,6 +221,8 @@ llvm_release_context(JitContext *context)
}
list_free(llvm_context->handles);
llvm_context->handles = NIL;
+
+ llvm_leave_fatal_on_oom();
}
/*