summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHeikki Linnakangas2023-07-05 10:13:13 +0000
committerHeikki Linnakangas2023-07-05 10:14:33 +0000
commit2316ff1ae5a8064c2604247bfc4695d53b3e4158 (patch)
treee637f235bccc812d209730a9466f501e7ade38f3 /src
parent6377f705cab2f8f3e4017cd9852887906c8ac053 (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/54b78cca-bc84-dad8-4a7e-5b56f764fab5@iki.fi
Diffstat (limited to 'src')
-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 8b0576b6e47..dc3efd27460 100644
--- a/src/backend/jit/llvm/llvmjit.c
+++ b/src/backend/jit/llvm/llvmjit.c
@@ -230,6 +230,8 @@ llvm_release_context(JitContext *context)
pfree(jit_handle);
}
+
+ llvm_leave_fatal_on_oom();
}
/*