Skip to content

feat(sys): add free_use_pagemap feature - #109

Merged
Brooooooklyn merged 1 commit into
napi-rs:mainfrom
popescuoctavian:feat/free-use-pagemap
Oct 24, 2026
Merged

Brooooooklyn merged 1 commit into
napi-rs:mainfrom
popescuoctavian:feat/free-use-pagemap

Conversation

@popescuoctavian

Copy link
Copy Markdown
Contributor

Adds a free_use_pagemap feature that builds mimalloc v3 with MI_FREE_USE_PAGEMAP=1 (cmake and Windows MSVC builds). It has no effect on v2.

Why

Since mimalloc 3.5.0, objects larger than 256 MiB no longer fit in arenas (mi_arena_max_fixed_object_size(), previously ~16 GiB). Each such allocation becomes a fresh mmap/munmap. Building with MI_FREE_USE_PAGEMAP lifts the cap, and no runtime option can.

In EDR, trace buffers grow past 256 MiB. Upgrading to mimalloc-safe 0.1.67 (mimalloc 3.5.2) regressed one benchmark:

wall sys page faults
mimalloc 3.3.2 49 s 2.6 s 0.3 M
mimalloc 3.5.2 59 s 11 s 5.8 M
3.5.2 + MI_FREE_USE_PAGEMAP=1 47.3 s 2.2 s 0.25 M

We currently pass the define through CFLAGS/CXXFLAGS. Any CFLAGS set in the environment silently overrides it, so a feature flag is more reliable.

@Brooooooklyn

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review 🔄 Running since 2026-10-24T09:27:11.337155Z 2edc920 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@Brooooooklyn
Brooooooklyn merged commit a16a770 into napi-rs:main Oct 24, 2026
18 of 19 checks passed
@github-actions github-actions Bot mentioned this pull request Oct 24, 2026
Brooooooklyn pushed a commit that referenced this pull request Oct 24, 2026
## 🤖 New release

* `libmimalloc-sys2`: 0.1.63 -> 0.1.64 (✓ API compatible changes)
* `mimalloc-safe`: 0.1.67 -> 0.1.68 (✓ API compatible changes)

<details><summary><i><b>Changelog</b></i></summary><p>

## `libmimalloc-sys2`

<blockquote>

## [0.1.64] - 2026-10-24

### Features

- *(sys)* Add free_use_pagemap feature
([#109](#109))

### Chore

- *(deps)* Update mimalloc3 to v3.6.0
([#110](#110))
</blockquote>

## `mimalloc-safe`

<blockquote>

## [0.1.68] - 2026-10-24

### Features

- *(sys)* Add free_use_pagemap feature
([#109](#109))

### Bug Fixes

- *(ci)* Locate armv7 GCC runtime when using Clang
([#111](#111))

### Chore

- *(deps)* Update mimalloc3 to v3.6.0
([#110](#110))
- *(deps)* Update emnapi to v2.0.0-beta.2
([#108](#108))
- *(deps)* Update yarn to v4.18.1
([#107](#107))
- *(deps)* Update dependency @napi-rs/cli to v3.10.9
([#103](#103))
- *(deps)* Update dependency @napi-rs/cli to v3.10.9
([#114](#114))
</blockquote>


</p></details>

---
This PR was generated with
[release-plz](https://github.com/release-plz/release-plz/).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants