Skip to content

mallopt(M_ARENA_MAX, 4)#119

Merged
serprex merged 2 commits into
mainfrom
mallopt-arena-max
Jul 14, 2026
Merged

mallopt(M_ARENA_MAX, 4)#119
serprex merged 2 commits into
mainfrom
mallopt-arena-max

Conversation

@serprex

@serprex serprex commented Jul 14, 2026

Copy link
Copy Markdown
Member

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a glibc-specific mallopt(M_ARENA_MAX, 4) call in the background worker startup path to reduce virtual memory usage by limiting glibc malloc arenas before gRPC/Arrow-related threads are created.

Changes:

  • Add glibc-only #include <malloc.h> to access mallopt() / M_ARENA_MAX.
  • Call mallopt(M_ARENA_MAX, 4) at the start of PschBgworkerMain() (glibc-only) to cap arena growth.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/worker/bgworker.c
Copilot AI review requested due to automatic review settings July 14, 2026 15:03

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

@serprex

serprex commented Jul 14, 2026

Copy link
Copy Markdown
Member Author

with #121 we're fine to set this to 2

@JoshDreamland JoshDreamland left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I worry this isn't the full story for cutting back gRPC usage, but seems safe enough to find out.

My main concern was that this should only affect the bgworker, which indeed seems to be the case. Because it's a C++ library, I do worry we could be starting up some gRPC logic in the main process; can't tell that by glancing the code.

serprex and others added 2 commits July 14, 2026 19:11
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 14, 2026 19:11
@serprex serprex force-pushed the mallopt-arena-max branch from 2d720f6 to 62e45bd Compare July 14, 2026 19:11
@serprex

serprex commented Jul 14, 2026

Copy link
Copy Markdown
Member Author

full story is #121 but this'll help virtual memory usage on fat instances

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

Comment thread src/worker/bgworker.c
@serprex serprex merged commit 4288d04 into main Jul 14, 2026
13 checks passed
@serprex serprex deleted the mallopt-arena-max branch July 14, 2026 19:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants