8000 Fix leak of LLVM "fatal-on-oom" section counter. · postgres/postgres@2316ff1 · GitHub
[go: up one dir, main page]

Skip to content

Commit 2316ff1

Browse files
committed
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
1 parent 6377f70 commit 2316ff1

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/backend/jit/llvm/llvmjit.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,8 @@ llvm_release_context(JitContext *context)
230230

231231
pfree(jit_handle);
232232
}
233+
234+
llvm_leave_fatal_on_oom();
233235
}
234236

235237
/*

0 commit comments

Comments
 (0)
0