jemalloc used the nonstandard `std::__throw_bad_alloc`, which is no
longer visible in GCC 16. this upstream patch makes it conditional on
exceptions and defers to either `throw std::bad_alloc()` or
`std::terminate` as appropriate, and fixes the build.
This fixes rust-jemalloc-sys build on darwin.
Linux builds pass only when overcommit is enabled in kernel, so it's
better to disable it for both platforms.
See: https://github.com/jemalloc/jemalloc/pull/2954
Assisted-by: Codex gpt-5.5 xhigh
This commit exposes the page size as an overridable `pageSizeKiB` argument
instead of hardcoding the lg-page logic inline. This lets users tune
jemalloc for their specific kernel page size via an overlay, e.g.
`jemalloc.override { pageSizeKiB = 4; }` for 4KB-page kernels on a platform
that ordinarily would have 64KB pages.
Most ppc64 kernels default to 64KB pages, for example, Fedora, SUSE,
Arch POWER, and the upstream kernel itself (for Book3S, i.e. POWER4+)
all ship with `CONFIG_PPC_64K_PAGES=y`, however, NixOS forces 4KB
pages via `PPC_4K_PAGES`. A higher `--with-lg-page` is
forward-compatible with lower page sizes but may waste some memory, so
this commit trades a small amount of memory for broader build-host
compatibility.