Skip to content

Support prefixed jemalloc when USE_JEMALLOC is enabled - #2723

Open
adamant-pwn wants to merge 1 commit into
meta:mainfrom
ratschlab:codex/jemalloc-prefix
Open

adamant-pwn wants to merge 1 commit into
meta:mainfrom
ratschlab:codex/jemalloc-prefix

Conversation

@adamant-pwn

@adamant-pwn adamant-pwn commented Oct 10, 2026 •

Copy link
Copy Markdown

With USE_JEMALLOC, Folly calls unprefixed allocator helpers even when jemalloc was built with a symbol prefix (as on conda-forge macOS). Weak declarations can let this compile while calls still resolve to missing functions. Bind these helpers through jemalloc's documented je_* aliases in Folly's portability header, leaving standard allocation names and automatic allocator detection unchanged.

Retain the je_* aliases with JEMALLOC_NO_DEMANGLE, including for consumers that include jemalloc first. Register the existing MallocTest suite with CMake and add an allocation/deallocation smoke test. This smoke test alone does not establish prefixed-allocator compatibility.

Tested: 101 selected allocator/vector tests pass with unprefixed jemalloc 5.4.0. A separate Linux link-and-run reproduction with prefixed jemalloc 5.4.0 crashes without the patch and passes with it. Mac header probes compile, but full native Mac and Rosetta runtime validation of this upstream version is pending.

Prepared with AI assistance; this PR remains a draft for review.

@meta-cla

meta-cla Bot commented Oct 10, 2026

Copy link
Copy Markdown

Hi @adamant-pwn!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

@meta-cla

meta-cla Bot commented Oct 27, 2026

Copy link
Copy Markdown

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@adamant-pwn
adamant-pwn marked this pull request as ready for review November 2, 2026 19:23
@adamant-pwn
adamant-pwn force-pushed the codex/jemalloc-prefix branch from 2c06de8 to 0074a54 Compare November 12, 2026 18:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant