mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-07-13 04:07:23 +03:00
No description
The Apple branch read the CPU number from the low 3 bits of `tpidrro_el0`. That layout no longer holds on Apple Silicon: those bits read back as 0, so `malloc_getcpu` returned 0 for every thread. `percpu_arena` then funneled all allocations into arena 0, or was disabled outright at init. Read the CPU number the same way as libplatform's `_os_cpu_number`: the low 12 bits of `tpidr_el0` on arm64, or of the IDT base (via `sidt`) on x86. Also move the Apple branch ahead of the `rdtscp` one so Apple x86 uses `sidt` rather than `rdtscp`, whose `ecx` is not the CPU id under XNU. https://github.com/apple-oss-distributions/xnu/blob/main/libsyscall/os/tsd.h Verified on a 12-CPU M2 Pro: with `percpu_arena:percpu`, `opt.percpu_arena` now stays `percpu` and `thread.arena` spreads across all 12 arenas {0..11}; the old code collapsed every thread onto arena 0. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> |
||
|---|---|---|
| .github/workflows | ||
| bin | ||
| build-aux | ||
| doc | ||
| doc_internal | ||
| include | ||
| m4 | ||
| msvc | ||
| scripts | ||
| src | ||
| test | ||
| .appveyor.yml | ||
| .autom4te.cfg | ||
| .clang-format | ||
| .git-blame-ignore-revs | ||
| .gitattributes | ||
| .gitignore | ||
| .travis.yml | ||
| autogen.sh | ||
| ChangeLog | ||
| config.stamp.in | ||
| configure.ac | ||
| COPYING | ||
| INSTALL.md | ||
| jemalloc.pc.in | ||
| Makefile.in | ||
| README | ||
| run_tests.sh | ||
| TUNING.md | ||
jemalloc is a general purpose malloc(3) implementation that emphasizes fragmentation avoidance and scalable concurrency support. jemalloc first came into use as the FreeBSD libc allocator in 2005, and since then it has found its way into numerous applications that rely on its predictable behavior. In 2010 jemalloc development efforts broadened to include developer support features such as heap profiling and extensive monitoring/tuning hooks. Modern jemalloc releases continue to be integrated back into FreeBSD, and therefore versatility remains critical. Ongoing development efforts trend toward making jemalloc among the best allocators for a broad range of demanding applications, and eliminating/mitigating weaknesses that have practical repercussions for real world applications. The COPYING file contains copyright and licensing information. The INSTALL file contains information on how to configure, build, and install jemalloc. The ChangeLog file contains a brief summary of changes for each release. URL: https://jemalloc.net/