Skip to content

build(jemalloc): patch jemalloc 5.3.1 source for libstdc++ 16+ ABI removal#9740

Open
matthewmcneely wants to merge 1 commit into
mainfrom
oss-jemalloc-libstdcxx16-patch
Open

build(jemalloc): patch jemalloc 5.3.1 source for libstdc++ 16+ ABI removal#9740
matthewmcneely wants to merge 1 commit into
mainfrom
oss-jemalloc-libstdcxx16-patch

Conversation

@matthewmcneely

Copy link
Copy Markdown
Contributor

Problem

libstdc++ 16 removed std::__throw_bad_alloc from the public ABI. jemalloc 5.3.1's src/jemalloc_cpp.cpp still calls that legacy private symbol and fails to compile under GCC 16 / libstdc++ 16:

src/jemalloc_cpp.cpp:103:22: error: '__throw_bad_alloc' is not a member of 'std'

dgraph/Makefile builds jemalloc 5.3.1 from source (the distro package lacks the je_ symbol prefix ristretto's cgo binding needs), so any toolchain on GCC 16+ hits this during make dgraph.

Fix

Add a sed substitution in the jemalloc: target that rewrites the legacy call to the standard throw std::bad_alloc() after the tarball is extracted and before ./configure runs. The substitution is exact-match, so it's a no-op on older libstdc++ where the legacy symbol still exists.

Can be dropped once jemalloc cuts a release with the fix baked in and JEMALLOC_URL bumps past it.

…moval

libstdc++ 16 removed `std::__throw_bad_alloc` from the public ABI. jemalloc 5.3.1's src/jemalloc_cpp.cpp still calls that legacy private symbol and fails to compile under GCC 16 / libstdc++ 16:

    src/jemalloc_cpp.cpp:103:22: error: '__throw_bad_alloc' is not a member of 'std'

dgraph/Makefile builds jemalloc 5.3.1 from source (the distro package lacks the je_ symbol prefix ristretto's cgo binding needs), so any toolchain on GCC 16+ hits this during `make dgraph`. Add a sed substitution in the jemalloc: target that rewrites the legacy call to the standard `throw std::bad_alloc()` after extraction and before ./configure. The substitution is exact-match, so it is a no-op on older libstdc++ where the legacy symbol still exists.

Can be dropped once jemalloc cuts a release with the fix and JEMALLOC_URL bumps past it.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@matthewmcneely matthewmcneely requested a review from a team as a code owner June 11, 2026 18:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant