Two malloc arenas 19527875ebdc
glibc gives each thread that allocates an arena of its own and keeps what is freed there. The first commit of the Linux tree, read and hashed across four threads, peaked at 4.3 GB resident for 2.7 GB in use; with two arenas it peaks at 3.1 GB, no slower. MALLOC_ARENA_MAX, when set, still decides. refs #35
- Author
- Andy McCall @andymccall <[email protected]>
- When
- · 2026-09-30 08:10 UTC
- Signature
- ✔ signed by Andy McCall
- Hash
19527875ebdc04f181f5283fed0256f3b7d588531f9c096489eae397aff944cc- Depends on
- 5b1114a04905 d443639bcf35 ff0af1ee299d
- Depended on by
- e0d56dfca51d
- In bookmarks
- agents-in-readme bare-hashes carried-not-removed carry-identical doctor-trust identical-sides keyless-tags main merge-remote-bookmark only-help-103 paths-for-resolutions-and-amend push-notes show-stat subrepo-pin-state switch-says
- In tags
- v0.1.0 v0.10.0 v0.11.0 v0.2.0 v0.3.0 v0.3.1 v0.4.0 v0.4.1 v0.4.2 v0.4.3 v0.4.4 v0.4.5 v0.4.6 v0.5.0 v0.5.1 v0.6.0 v0.7.0 v0.8.0 v0.9.0
- Edits
- 1 atom, 0 tree operations, 1 file
Browse the tree at this change
modified src/main.rs +10 −0
| … | 15 unchanged lines |
||
| 16 | 16 | unsafe { |
|
| 17 | 17 | libc::signal(libc::SIGPIPE, libc::SIG_DFL); |
|
| 18 | 18 | } |
|
| 19 | + | // glibc gives each thread that allocates an arena of its own and keeps |
|
| 20 | + | // what is freed there: the first commit of the Linux tree, read and |
|
| 21 | + | // hashed across threads, held 4.3 GB for 2.7 GB in use. Two arenas |
|
| 22 | + | // hold 3.1 GB, no slower. MALLOC_ARENA_MAX still has the last word. |
|
| 23 | + | #[cfg(all(target_os = "linux", target_env = "gnu"))] |
|
| 24 | + | if std::env::var_os("MALLOC_ARENA_MAX").is_none() { |
|
| 25 | + | unsafe { |
|
| 26 | + | libc::mallopt(libc::M_ARENA_MAX, 2); |
|
| 27 | + | } |
|
| 28 | + | } |
|
| 19 | 29 | let result = cli::run(); |
|
| 20 | 30 | oxy_core::timing::memory_summary(); |
|
| 21 | 31 | match result { |
|
| … | 8 unchanged lines |