Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/worker/bgworker.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@
#include "queue/shmem.h"

#include <signal.h>
#ifdef __GLIBC__
#include <malloc.h>
#endif

#include "config/guc.h"
#include "export/stats_exporter.h"
Expand Down Expand Up @@ -182,6 +185,12 @@ static void RunExportCycle(uint32 wait_event) {
}

void PschBgworkerMain(Datum main_arg pg_attribute_unused()) {
#ifdef __GLIBC__
// Set before any gRPC/Arrow threads are created; cap glibc malloc arenas to reduce virtual memory usage.
if (mallopt(M_ARENA_MAX, 4) == 0) {
elog(DEBUG1, "pg_stat_ch: mallopt(M_ARENA_MAX, 4) failed");
}
Comment thread
serprex marked this conversation as resolved.
#endif
Comment thread
Copilot marked this conversation as resolved.
SetupSignalHandlers();
BackgroundWorkerUnblockSignals();
BackgroundWorkerInitializeConnection("postgres", NULL, 0);
Expand Down
Loading