├── .github ├── FUNDING.yml └── workflows │ ├── ci.yml │ └── release-plz.yml ├── .gitignore ├── .gitmodules ├── CHANGELOG.md ├── Cargo.toml ├── LICENSE.txt ├── README.md ├── cliff.toml ├── example ├── .gitignore ├── .yarnrc.yml ├── Cargo.toml ├── build.rs ├── index.d.ts ├── package.json ├── src │ └── lib.rs └── yarn.lock ├── libmimalloc-sys ├── .gitignore ├── CHANGELOG.md ├── Cargo.toml ├── LICENSE.txt ├── build.rs ├── src │ ├── extended.rs │ └── lib.rs └── sys-test │ ├── Cargo.toml │ ├── build.rs │ └── src │ └── main.rs ├── release-plz.toml ├── renovate.json └── src ├── extended.rs └── lib.rs /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: [napi-rs, Brooooooklyn] -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | pull_request: 8 | # Run daily to catch when Rust updates cause problems to happen. 9 | schedule: 10 | - cron: '00 01 * * *' 11 | 12 | jobs: 13 | rust: 14 | name: Rust 15 | 16 | strategy: 17 | fail-fast: false 18 | matrix: 19 | os: [ubuntu-latest, macos-latest, windows-latest] 20 | toolchain: ["stable"] 21 | 22 | runs-on: ${{ matrix.os }} 23 | 24 | env: 25 | CARGO_INCREMENTAL: 0 26 | RUST_BACKTRACE: 1 27 | 28 | steps: 29 | - name: Checkout repository 30 | uses: actions/checkout@v4 31 | with: 32 | submodules: recursive 33 | 34 | - name: Install Rust toolchain 35 | uses: dtolnay/rust-toolchain@master 36 | with: 37 | toolchain: ${{ matrix.toolchain }} 38 | 39 | - name: Build (secure) 40 | run: cargo build --features secure 41 | 42 | - name: Test (secure) 43 | run: cargo test --features secure 44 | 45 | - name: Test libmimalloc-sys crate bindings (secure) 46 | run: cargo run --features secure -p libmimalloc-sys-test 47 | 48 | - name: Build (no secure) 49 | run: cargo build 50 | 51 | - name: Test (no secure) 52 | run: cargo test 53 | 54 | - name: Test libmimalloc-sys crate bindings (no secure) 55 | run: cargo run -p libmimalloc-sys-test 56 | 57 | - name: Build (extended) 58 | run: cargo build --features extended 59 | 60 | - name: Test (extended) 61 | run: cargo test --features extended 62 | 63 | - name: Test libmimalloc-sys crate bindings (extended) 64 | run: cargo run --features extended -p libmimalloc-sys-test 65 | 66 | lint: 67 | name: Rustfmt / Clippy 68 | runs-on: ubuntu-latest 69 | 70 | steps: 71 | - uses: actions/checkout@v4 72 | with: 73 | submodules: recursive 74 | 75 | - uses: dtolnay/rust-toolchain@stable 76 | with: 77 | components: rustfmt, clippy 78 | 79 | - name: Fmt 80 | run: cargo fmt --all -- --check 81 | 82 | - name: Clippy 83 | run: cargo clippy --workspace -- -D warnings 84 | 85 | # Detect cases where documentation links would be dead 86 | doc: 87 | name: Check documentation 88 | runs-on: ubuntu-latest 89 | steps: 90 | 91 | - uses: actions/checkout@v4 92 | with: 93 | submodules: recursive 94 | 95 | - uses: dtolnay/rust-toolchain@nightly 96 | 97 | # Note: We need to use nightly rust, and `cargo rustdoc` (yes, not `cargo 98 | # doc`) to actually get it to respect -D warnings... Using nightly also 99 | # gets us the nicer syntax for linking to functions, and is in-line with 100 | # what docs.rs uses. 101 | 102 | - name: 'Check documentation links in `mimalloc`' 103 | run: cargo rustdoc -- -D warnings 104 | 105 | - name: 'Check documentation links in `libmimalloc-sys`' 106 | run: cargo rustdoc -p libmimalloc-sys2 -- -D warnings 107 | 108 | build-example: 109 | name: Build example ${{ matrix.settings.target }} 110 | strategy: 111 | fail-fast: false 112 | matrix: 113 | settings: 114 | - host: macos-latest 115 | target: x86_64-apple-darwin 116 | - host: windows-latest 117 | target: x86_64-pc-windows-msvc 118 | - host: windows-latest 119 | target: i686-pc-windows-msvc 120 | - host: ubuntu-latest 121 | target: x86_64-unknown-linux-gnu 122 | - host: ubuntu-latest 123 | target: x86_64-unknown-linux-musl 124 | - host: macos-latest 125 | target: aarch64-apple-darwin 126 | - host: ubuntu-24.04-arm 127 | target: aarch64-unknown-linux-gnu 128 | - host: ubuntu-latest 129 | target: armv7-unknown-linux-gnueabihf 130 | - host: ubuntu-latest 131 | target: aarch64-linux-android 132 | - host: ubuntu-24.04-arm 133 | target: aarch64-unknown-linux-musl 134 | - host: windows-latest 135 | target: aarch64-pc-windows-msvc 136 | - host: ubuntu-latest 137 | target: powerpc64le-unknown-linux-gnu 138 | - host: ubuntu-latest 139 | target: s390x-unknown-linux-gnu 140 | - host: ubuntu-latest 141 | target: wasm32-wasip1-threads 142 | 143 | runs-on: ${{ matrix.settings.host }} 144 | 145 | steps: 146 | - uses: actions/checkout@v4 147 | with: 148 | submodules: recursive 149 | 150 | - name: Install 151 | run: rustup target add ${{ matrix.settings.target }} 152 | 153 | - uses: goto-bus-stop/setup-zig@v2 154 | if: ${{ contains(matrix.settings.target, 'musl') }} 155 | with: 156 | version: 0.14.1 157 | 158 | - name: Install cargo-zigbuild 159 | uses: taiki-e/install-action@v2 160 | if: ${{ contains(matrix.settings.target, 'musl') }} 161 | env: 162 | GITHUB_TOKEN: ${{ github.token }} 163 | with: 164 | tool: cargo-zigbuild 165 | 166 | - uses: actions/setup-node@v4 167 | with: 168 | node-version: 22 169 | 170 | - name: Install dependencies 171 | working-directory: example 172 | run: | 173 | corepack enable 174 | yarn install 175 | 176 | - name: Install wasi-sdk 177 | if: ${{ matrix.settings.target == 'wasm32-wasip1-threads' }} 178 | run: | 179 | mkdir -p $HOME/wasi-sdk 180 | curl -L https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-25/wasi-sdk-25.0-x86_64-linux.tar.gz | tar -xzf - -C $HOME/wasi-sdk --strip-components=1 181 | echo "WASI_SDK_PATH=$HOME/wasi-sdk" >> $GITHUB_ENV 182 | 183 | - name: Build 184 | working-directory: example 185 | shell: bash 186 | run: | 187 | if [[ "${{ matrix.settings.target }}" == *"musl"* ]]; then 188 | yarn build --target ${{ matrix.settings.target }} -x 189 | yarn build --target ${{ matrix.settings.target }} -x --release 190 | elif [[ "${{ matrix.settings.target }}" == *"gnu"* ]]; then 191 | export TARGET_CFLAGS="-fuse-ld=lld" 192 | export TARGET_CC=clang 193 | yarn build --target ${{ matrix.settings.target }} --use-napi-cross 194 | yarn build --target ${{ matrix.settings.target }} --use-napi-cross --release 195 | elif [[ "${{ matrix.settings.target }}" == *"msvc"* ]]; then 196 | yarn build --target ${{ matrix.settings.target }} 197 | yarn build --target ${{ matrix.settings.target }} --release 198 | mkdir -p .cargo 199 | echo "[target.${{ matrix.settings.target }}]" >> .cargo/config.toml 200 | echo "rustflags = [\"-C\", \"target-feature=+crt-static\"]" >> .cargo/config.toml 201 | yarn build --target ${{ matrix.settings.target }} --release 202 | else 203 | yarn build --target ${{ matrix.settings.target }} 204 | yarn build --target ${{ matrix.settings.target }} --release 205 | fi 206 | -------------------------------------------------------------------------------- /.github/workflows/release-plz.yml: -------------------------------------------------------------------------------- 1 | name: Release Plz 2 | 3 | permissions: {} 4 | 5 | on: 6 | workflow_dispatch: 7 | push: 8 | branches: 9 | - main 10 | 11 | concurrency: 12 | group: ${{ github.workflow }}-${{ github.ref }} 13 | cancel-in-progress: true 14 | 15 | jobs: 16 | release-plz: 17 | runs-on: ubuntu-latest 18 | permissions: 19 | contents: write 20 | pull-requests: write 21 | steps: 22 | - uses: actions/checkout@v4 23 | with: 24 | fetch-depth: 0 25 | submodules: recursive 26 | 27 | - name: Run release-plz 28 | id: release-plz 29 | uses: release-plz/action@v0.5 30 | env: 31 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 32 | CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_API_TOKEN }} 33 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | **/*.rs.bk 3 | Cargo.lock 4 | .DS_Store -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "libmimalloc-sys/c_src/mimalloc"] 2 | path = libmimalloc-sys/c_src/mimalloc 3 | url = https://github.com/microsoft/mimalloc.git 4 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | All notable changes to this project will be documented in this file. 4 | 5 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), 6 | and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). 7 | 8 | ## [Unreleased] 9 | 10 | ## [0.1.54](https://github.com/napi-rs/mimalloc-safe/compare/mimalloc-safe-v0.1.53...mimalloc-safe-v0.1.54) - 2025-07-10 11 | 12 | ### Features 13 | 14 | - *(sys)* upgrade mimalloc to v2.2.4 ([#24](https://github.com/napi-rs/mimalloc-safe/pull/24)) 15 | 16 | ## [0.1.53](https://github.com/napi-rs/mimalloc-safe/compare/mimalloc-safe-v0.1.52...mimalloc-safe-v0.1.53) - 2025-06-16 17 | 18 | ### Bug Fixes 19 | 20 | - add MI_NO_OPT_ARCH OFF when no_opt_arch is on ([#22](https://github.com/napi-rs/mimalloc-safe/pull/22)) 21 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "mimalloc-safe" 3 | version = "0.1.54" 4 | authors = [ 5 | "Octavian Oncescu ", 6 | "Vincent Rouillé ", 7 | "Thom Chiovoloni ", 8 | "Long Yinan " 9 | ] 10 | edition = "2021" 11 | repository = "https://github.com/napi-rs/mimalloc-safe" 12 | keywords = ["mimalloc", "allocator", "encrypted-heap", "performance"] 13 | categories = ["memory-management", "api-bindings"] 14 | description = "Performance and security oriented drop-in allocator" 15 | license = "MIT" 16 | readme = "README.md" 17 | 18 | [workspace] 19 | members = ["libmimalloc-sys", "libmimalloc-sys/sys-test", "example"] 20 | 21 | [badges] 22 | travis-ci = { repository = "purpleprotocol/mimalloc_rust" } 23 | 24 | [dependencies] 25 | libmimalloc-sys2 = { path = "libmimalloc-sys", version = "0.1.50", default-features = false } 26 | 27 | [features] 28 | asm = ["libmimalloc-sys2/asm"] 29 | default = [] 30 | secure = ["libmimalloc-sys2/secure"] 31 | override = ["libmimalloc-sys2/override"] 32 | local_dynamic_tls = ["libmimalloc-sys2/local_dynamic_tls"] 33 | no_thp = ["libmimalloc-sys2/no_thp"] 34 | no_opt_arch = ["libmimalloc-sys2/no_opt_arch"] 35 | extended = ["libmimalloc-sys2/extended"] 36 | skip_collect_on_exit = ["libmimalloc-sys2/skip_collect_on_exit"] 37 | 38 | etw = ["libmimalloc-sys2/etw"] 39 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright 2019 Octavian Oncescu 2 | 3 | Permission is hereby granted, free of charge, to any 4 | person obtaining a copy of this software and associated 5 | documentation files (the "Software"), to deal in the 6 | Software without restriction, including without 7 | limitation the rights to use, copy, modify, merge, 8 | publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software 10 | is furnished to do so, subject to the following 11 | conditions: 12 | 13 | The above copyright notice and this permission notice 14 | shall be included in all copies or substantial portions 15 | of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF 18 | ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 19 | TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 20 | PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 21 | SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 22 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 23 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 24 | IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 25 | DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # `mimalloc-safe` 2 | 3 | Forked from https://github.com/purpleprotocol/mimalloc_rust 4 | 5 | [![Latest Version]][crates.io] [![Documentation]][docs.rs] 6 | 7 | A drop-in global allocator wrapper around the [mimalloc](https://github.com/microsoft/mimalloc) allocator. 8 | Mimalloc is a general purpose, performance oriented allocator built by Microsoft. 9 | 10 | ## Usage 11 | 12 | ```rust 13 | use mimalloc_safe::MiMalloc; 14 | 15 | #[global_allocator] 16 | static GLOBAL: MiMalloc = MiMalloc; 17 | ``` 18 | 19 | ## Requirements 20 | 21 | A **C** compiler is required for building [mimalloc](https://github.com/microsoft/mimalloc) with cargo. 22 | 23 | ## Usage with secure mode 24 | 25 | Using secure mode adds guard pages, 26 | randomized allocation, encrypted free lists, etc. The performance penalty is usually 27 | around 10% according to [mimalloc](https://github.com/microsoft/mimalloc) 28 | own benchmarks. 29 | 30 | To enable secure mode, put in `Cargo.toml`: 31 | 32 | ```ini 33 | [dependencies] 34 | mimalloc-safe = { version = "*", features = ["secure"] } 35 | ``` 36 | 37 | [crates.io]: https://crates.io/crates/mimalloc-safe 38 | [Latest Version]: https://img.shields.io/crates/v/mimalloc-safe.svg 39 | [Documentation]: https://docs.rs/mimalloc-safe/badge.svg 40 | [docs.rs]: https://docs.rs/mimalloc-safe 41 | -------------------------------------------------------------------------------- /cliff.toml: -------------------------------------------------------------------------------- 1 | # git-cliff ~ configuration file 2 | # https://git-cliff.org/docs/configuration 3 | 4 | [git] 5 | commit_parsers = [ 6 | { message = "^doc", group = "Documentation" }, 7 | { message = "^feat", group = "Features" }, 8 | { message = "^fix", group = "Bug Fixes" }, 9 | { message = "^perf", group = "Performance" }, 10 | { message = "^refactor", group = "Refactor" }, 11 | { message = "^style", group = "Styling" }, 12 | { message = "^test", group = "Testing" }, 13 | ] 14 | # protect breaking changes from being skipped due to matching a skipping commit_parser 15 | protect_breaking_commits = false 16 | -------------------------------------------------------------------------------- /example/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .yarn 3 | *.node 4 | *.wasm -------------------------------------------------------------------------------- /example/.yarnrc.yml: -------------------------------------------------------------------------------- 1 | nodeLinker: node-modules -------------------------------------------------------------------------------- /example/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "mimalloc_example" 3 | version = "0.1.0" 4 | edition = "2024" 5 | publish = false 6 | 7 | [lib] 8 | crate-type = ["cdylib", "lib"] 9 | 10 | [dependencies] 11 | napi = "3.0.0-beta" 12 | napi-derive = "3.0.0-beta" 13 | 14 | [target.'cfg(target_os = "linux")'.dependencies] 15 | mimalloc-safe = { path = "../", features = ["local_dynamic_tls", "skip_collect_on_exit"] } 16 | 17 | [target.'cfg(not(target_os = "linux"))'.dependencies] 18 | mimalloc-safe = { path = "../", features = ["skip_collect_on_exit"] } 19 | 20 | [build-dependencies] 21 | napi-build = "2" 22 | -------------------------------------------------------------------------------- /example/build.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | napi_build::setup(); 3 | } 4 | -------------------------------------------------------------------------------- /example/index.d.ts: -------------------------------------------------------------------------------- 1 | /* auto-generated by NAPI-RS */ 2 | /* eslint-disable */ 3 | export declare function hello(): string 4 | -------------------------------------------------------------------------------- /example/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "mimalloc-example", 3 | "private": true, 4 | "scripts": { 5 | "build": "napi build" 6 | }, 7 | "devDependencies": { 8 | "@napi-rs/cli": "canary" 9 | }, 10 | "packageManager": "yarn@4.9.2" 11 | } 12 | -------------------------------------------------------------------------------- /example/src/lib.rs: -------------------------------------------------------------------------------- 1 | use napi_derive::napi; 2 | 3 | #[global_allocator] 4 | static ALLOC: mimalloc_safe::MiMalloc = mimalloc_safe::MiMalloc; 5 | 6 | #[napi] 7 | pub fn hello() -> String { 8 | "Hello, world!".to_string() 9 | } 10 | -------------------------------------------------------------------------------- /example/yarn.lock: -------------------------------------------------------------------------------- 1 | # This file is generated by running "yarn install" inside your project. 2 | # Manual changes might be lost - proceed with caution! 3 | 4 | __metadata: 5 | version: 8 6 | cacheKey: 10c0 7 | 8 | "@emnapi/core@npm:^1.4.3": 9 | version: 1.4.4 10 | resolution: "@emnapi/core@npm:1.4.4" 11 | dependencies: 12 | "@emnapi/wasi-threads": "npm:1.0.3" 13 | tslib: "npm:^2.4.0" 14 | checksum: 10c0/a3a87b384de7c87edc8d64dfbd0c695fb8e9c8547d2d53f284b15415cfea29150f933cb21017dc4d0fa9dbfb2b544d23c77da7cde8c82f21e68323db50a829dd 15 | languageName: node 16 | linkType: hard 17 | 18 | "@emnapi/runtime@npm:^1.4.3": 19 | version: 1.4.4 20 | resolution: "@emnapi/runtime@npm:1.4.4" 21 | dependencies: 22 | tslib: "npm:^2.4.0" 23 | checksum: 10c0/ec91747af3104ac34d4767fab922c8fe78ddc8ec83af3e3fb0edbf63cdb683fb8582be36afda7d48249fe729d4a31c34752c6e051770a762a68bce67a7408189 24 | languageName: node 25 | linkType: hard 26 | 27 | "@emnapi/wasi-threads@npm:1.0.3": 28 | version: 1.0.3 29 | resolution: "@emnapi/wasi-threads@npm:1.0.3" 30 | dependencies: 31 | tslib: "npm:^2.4.0" 32 | checksum: 10c0/00cae4dd64143cca21a3aedbf64a7a5528a5991b69bcc0b7306812ff31a3fdc4aaf5bc9413a29fbd5d577c78aae49db4fc4e736d013aec5d416b5a64d403f391 33 | languageName: node 34 | linkType: hard 35 | 36 | "@inquirer/checkbox@npm:^4.1.9": 37 | version: 4.1.9 38 | resolution: "@inquirer/checkbox@npm:4.1.9" 39 | dependencies: 40 | "@inquirer/core": "npm:^10.1.14" 41 | "@inquirer/figures": "npm:^1.0.12" 42 | "@inquirer/type": "npm:^3.0.7" 43 | ansi-escapes: "npm:^4.3.2" 44 | yoctocolors-cjs: "npm:^2.1.2" 45 | peerDependencies: 46 | "@types/node": ">=18" 47 | peerDependenciesMeta: 48 | "@types/node": 49 | optional: true 50 | checksum: 10c0/d1a93c31f3dad37f060bfdb6a8ba53f2cd36cfca7766c464c34aa95ecf691956c32be2f5b71cc8633ed7581452a04ab7b3a025d662270460d21b25069651ed42 51 | languageName: node 52 | linkType: hard 53 | 54 | "@inquirer/confirm@npm:^5.1.13": 55 | version: 5.1.13 56 | resolution: "@inquirer/confirm@npm:5.1.13" 57 | dependencies: 58 | "@inquirer/core": "npm:^10.1.14" 59 | "@inquirer/type": "npm:^3.0.7" 60 | peerDependencies: 61 | "@types/node": ">=18" 62 | peerDependenciesMeta: 63 | "@types/node": 64 | optional: true 65 | checksum: 10c0/e09af25c4b4f51fdc7c6780e2325217515d3970a8baab3597ae27ea8d0ed68527c19b3ae95f85eeb62d880f6e8a0f3bff91277f0f46e092e993ca18ad17e4993 66 | languageName: node 67 | linkType: hard 68 | 69 | "@inquirer/core@npm:^10.1.14": 70 | version: 10.1.14 71 | resolution: "@inquirer/core@npm:10.1.14" 72 | dependencies: 73 | "@inquirer/figures": "npm:^1.0.12" 74 | "@inquirer/type": "npm:^3.0.7" 75 | ansi-escapes: "npm:^4.3.2" 76 | cli-width: "npm:^4.1.0" 77 | mute-stream: "npm:^2.0.0" 78 | signal-exit: "npm:^4.1.0" 79 | wrap-ansi: "npm:^6.2.0" 80 | yoctocolors-cjs: "npm:^2.1.2" 81 | peerDependencies: 82 | "@types/node": ">=18" 83 | peerDependenciesMeta: 84 | "@types/node": 85 | optional: true 86 | checksum: 10c0/2553eb059201ebb182eb8e55a278ce3f2848a3abdfcf26e651b57b146f35baa19a286af0365ee5968b4459a1be93864ebf205a7af32fed8f995b394750a1d1f4 87 | languageName: node 88 | linkType: hard 89 | 90 | "@inquirer/editor@npm:^4.2.14": 91 | version: 4.2.14 92 | resolution: "@inquirer/editor@npm:4.2.14" 93 | dependencies: 94 | "@inquirer/core": "npm:^10.1.14" 95 | "@inquirer/type": "npm:^3.0.7" 96 | external-editor: "npm:^3.1.0" 97 | peerDependencies: 98 | "@types/node": ">=18" 99 | peerDependenciesMeta: 100 | "@types/node": 101 | optional: true 102 | checksum: 10c0/40e85b4a598f3541f96185c61f0a5ba9abf9385f28cef8b8a1f9570729bbb98f32c80e98e4ce63bd3d07d4011b770d945587d9c6eecce3b03eb2ec08bd7f37ea 103 | languageName: node 104 | linkType: hard 105 | 106 | "@inquirer/expand@npm:^4.0.16": 107 | version: 4.0.16 108 | resolution: "@inquirer/expand@npm:4.0.16" 109 | dependencies: 110 | "@inquirer/core": "npm:^10.1.14" 111 | "@inquirer/type": "npm:^3.0.7" 112 | yoctocolors-cjs: "npm:^2.1.2" 113 | peerDependencies: 114 | "@types/node": ">=18" 115 | peerDependenciesMeta: 116 | "@types/node": 117 | optional: true 118 | checksum: 10c0/919e314c5bd86b957b491eff6aa79c990908b7898fc5d02968920be7866449d9dbf9bc33831eab922682e60b98553d753d1a3de6667fa6b1aa6443f457732713 119 | languageName: node 120 | linkType: hard 121 | 122 | "@inquirer/figures@npm:^1.0.12": 123 | version: 1.0.12 124 | resolution: "@inquirer/figures@npm:1.0.12" 125 | checksum: 10c0/08694288bdf9aa474571ca94272113a5ac443229519ce71447eba9eb7d5a2007901bdc3e92216d929a69746dcbac29683886c20e67b7864a7c7f6c59b99d3269 126 | languageName: node 127 | linkType: hard 128 | 129 | "@inquirer/input@npm:^4.2.0": 130 | version: 4.2.0 131 | resolution: "@inquirer/input@npm:4.2.0" 132 | dependencies: 133 | "@inquirer/core": "npm:^10.1.14" 134 | "@inquirer/type": "npm:^3.0.7" 135 | peerDependencies: 136 | "@types/node": ">=18" 137 | peerDependenciesMeta: 138 | "@types/node": 139 | optional: true 140 | checksum: 10c0/c9b671bbb8c8079e975c9138951b7abb6b06e04a44e47286b659569080140f5f18015ba3f2d55e90c5060a313a3c3e9e115138feced7abe7a94a43190a052199 141 | languageName: node 142 | linkType: hard 143 | 144 | "@inquirer/number@npm:^3.0.16": 145 | version: 3.0.16 146 | resolution: "@inquirer/number@npm:3.0.16" 147 | dependencies: 148 | "@inquirer/core": "npm:^10.1.14" 149 | "@inquirer/type": "npm:^3.0.7" 150 | peerDependencies: 151 | "@types/node": ">=18" 152 | peerDependenciesMeta: 153 | "@types/node": 154 | optional: true 155 | checksum: 10c0/066230f02cd253fe26cd78493c7c20b59063c8c2de5c8f5fadcaf4eb8650efc9e6555ba7d3703cc9ba7a751663f60e62e24b4a319d9536afa7ced7459e9b2320 156 | languageName: node 157 | linkType: hard 158 | 159 | "@inquirer/password@npm:^4.0.16": 160 | version: 4.0.16 161 | resolution: "@inquirer/password@npm:4.0.16" 162 | dependencies: 163 | "@inquirer/core": "npm:^10.1.14" 164 | "@inquirer/type": "npm:^3.0.7" 165 | ansi-escapes: "npm:^4.3.2" 166 | peerDependencies: 167 | "@types/node": ">=18" 168 | peerDependenciesMeta: 169 | "@types/node": 170 | optional: true 171 | checksum: 10c0/b77c57ba152b50c640cd77637d1ed23662059689546e33b235937e7e108fbbf72b9b5c61834c545f74f1d18d5c836ef5a0dc78da31ea6affe9842c3471a27325 172 | languageName: node 173 | linkType: hard 174 | 175 | "@inquirer/prompts@npm:^7.4.0": 176 | version: 7.6.0 177 | resolution: "@inquirer/prompts@npm:7.6.0" 178 | dependencies: 179 | "@inquirer/checkbox": "npm:^4.1.9" 180 | "@inquirer/confirm": "npm:^5.1.13" 181 | "@inquirer/editor": "npm:^4.2.14" 182 | "@inquirer/expand": "npm:^4.0.16" 183 | "@inquirer/input": "npm:^4.2.0" 184 | "@inquirer/number": "npm:^3.0.16" 185 | "@inquirer/password": "npm:^4.0.16" 186 | "@inquirer/rawlist": "npm:^4.1.4" 187 | "@inquirer/search": "npm:^3.0.16" 188 | "@inquirer/select": "npm:^4.2.4" 189 | peerDependencies: 190 | "@types/node": ">=18" 191 | peerDependenciesMeta: 192 | "@types/node": 193 | optional: true 194 | checksum: 10c0/a00186a71388308a1bc83bd96fef14c702b6cfa34ecd7c7cf880405295b25aefd18a3b79363d788c9c31a2aa5e30732d21467a5b716fc35cc5fd303745ff2218 195 | languageName: node 196 | linkType: hard 197 | 198 | "@inquirer/rawlist@npm:^4.1.4": 199 | version: 4.1.4 200 | resolution: "@inquirer/rawlist@npm:4.1.4" 201 | dependencies: 202 | "@inquirer/core": "npm:^10.1.14" 203 | "@inquirer/type": "npm:^3.0.7" 204 | yoctocolors-cjs: "npm:^2.1.2" 205 | peerDependencies: 206 | "@types/node": ">=18" 207 | peerDependenciesMeta: 208 | "@types/node": 209 | optional: true 210 | checksum: 10c0/2ee08bbdd982e4d565dc37b38b4f45e5a040ea1e60e3f8ec808106c1b541585e9a5c3a18f795ae2168820695ad55fb88b2e391c3a0d616a4e74620250292e2d3 211 | languageName: node 212 | linkType: hard 213 | 214 | "@inquirer/search@npm:^3.0.16": 215 | version: 3.0.16 216 | resolution: "@inquirer/search@npm:3.0.16" 217 | dependencies: 218 | "@inquirer/core": "npm:^10.1.14" 219 | "@inquirer/figures": "npm:^1.0.12" 220 | "@inquirer/type": "npm:^3.0.7" 221 | yoctocolors-cjs: "npm:^2.1.2" 222 | peerDependencies: 223 | "@types/node": ">=18" 224 | peerDependenciesMeta: 225 | "@types/node": 226 | optional: true 227 | checksum: 10c0/34330cec50dd72669cdee14a413e7b43dee0e09c8f181a86ccfbdac424b6296e39dcc3c5992168d06c8f5e4cab54644913d5281723fa7a0f454c2c3cafeea192 228 | languageName: node 229 | linkType: hard 230 | 231 | "@inquirer/select@npm:^4.2.4": 232 | version: 4.2.4 233 | resolution: "@inquirer/select@npm:4.2.4" 234 | dependencies: 235 | "@inquirer/core": "npm:^10.1.14" 236 | "@inquirer/figures": "npm:^1.0.12" 237 | "@inquirer/type": "npm:^3.0.7" 238 | ansi-escapes: "npm:^4.3.2" 239 | yoctocolors-cjs: "npm:^2.1.2" 240 | peerDependencies: 241 | "@types/node": ">=18" 242 | peerDependenciesMeta: 243 | "@types/node": 244 | optional: true 245 | checksum: 10c0/8c2dff78f331a52862252ffbc2ad1b8b91cbc556c2af1e6acc5878855ffff7048bb45eefa53e0ef4fbf5310361d9986d10c2882c2355f815e05d635cab9bb679 246 | languageName: node 247 | linkType: hard 248 | 249 | "@inquirer/type@npm:^3.0.7": 250 | version: 3.0.7 251 | resolution: "@inquirer/type@npm:3.0.7" 252 | peerDependencies: 253 | "@types/node": ">=18" 254 | peerDependenciesMeta: 255 | "@types/node": 256 | optional: true 257 | checksum: 10c0/bbaa33c274a10f70d3a587264e1db6dbfcd8c1458d595c54870d1d5b3fc113ab5063203ec12a098485bb9e2fcef1a87d8c6ecd2a6d44ddc575f5c4715379be5e 258 | languageName: node 259 | linkType: hard 260 | 261 | "@napi-rs/cli@npm:canary": 262 | version: 3.0.0-alpha.92 263 | resolution: "@napi-rs/cli@npm:3.0.0-alpha.92" 264 | dependencies: 265 | "@inquirer/prompts": "npm:^7.4.0" 266 | "@napi-rs/cross-toolchain": "npm:^0.0.19" 267 | "@napi-rs/wasm-tools": "npm:^0.0.3" 268 | "@octokit/rest": "npm:^22.0.0" 269 | clipanion: "npm:^4.0.0-rc.4" 270 | colorette: "npm:^2.0.20" 271 | debug: "npm:^4.4.0" 272 | emnapi: "npm:^1.4.0" 273 | find-up: "npm:^7.0.0" 274 | js-yaml: "npm:^4.1.0" 275 | lodash-es: "npm:^4.17.21" 276 | semver: "npm:^7.7.1" 277 | typanion: "npm:^3.14.0" 278 | wasm-sjlj: "npm:^1.0.6" 279 | peerDependencies: 280 | "@emnapi/runtime": ^1.1.0 281 | emnapi: ^1.1.0 282 | peerDependenciesMeta: 283 | "@emnapi/runtime": 284 | optional: true 285 | emnapi: 286 | optional: true 287 | bin: 288 | napi: ./dist/cli.js 289 | napi-raw: ./cli.mjs 290 | checksum: 10c0/58118e413e9f3d98b991ce1869475c06b6a837c0373f43bb74e2509d48d7d7281d1b4b9c3d2b5aa45c11957d08b5e758a547ae9757c8299ef72fb02751f03208 291 | languageName: node 292 | linkType: hard 293 | 294 | "@napi-rs/cross-toolchain@npm:^0.0.19": 295 | version: 0.0.19 296 | resolution: "@napi-rs/cross-toolchain@npm:0.0.19" 297 | dependencies: 298 | "@napi-rs/lzma": "npm:^1.4.1" 299 | "@napi-rs/tar": "npm:^0.1.4" 300 | debug: "npm:^4.4.0" 301 | peerDependencies: 302 | "@napi-rs/cross-toolchain-arm64-target-aarch64": ^0.0.19 303 | "@napi-rs/cross-toolchain-arm64-target-armv7": ^0.0.19 304 | "@napi-rs/cross-toolchain-arm64-target-x86_64": ^0.0.19 305 | "@napi-rs/cross-toolchain-x64-target-aarch64": ^0.0.19 306 | "@napi-rs/cross-toolchain-x64-target-armv7": ^0.0.19 307 | "@napi-rs/cross-toolchain-x64-target-x86_64": ^0.0.19 308 | peerDependenciesMeta: 309 | "@napi-rs/cross-toolchain-arm64-target-aarch64": 310 | optional: true 311 | "@napi-rs/cross-toolchain-arm64-target-armv7": 312 | optional: true 313 | "@napi-rs/cross-toolchain-arm64-target-x86_64": 314 | optional: true 315 | "@napi-rs/cross-toolchain-x64-target-aarch64": 316 | optional: true 317 | "@napi-rs/cross-toolchain-x64-target-armv7": 318 | optional: true 319 | "@napi-rs/cross-toolchain-x64-target-x86_64": 320 | optional: true 321 | checksum: 10c0/6084567d9d86a818bf600d354aefa88aebad6bd0d76de3e41b50b652dc47cdb2056e7482a68870665ecc9e74dd67fcf9fbc9c02057cec9aa17510b4adbabb326 322 | languageName: node 323 | linkType: hard 324 | 325 | "@napi-rs/lzma-android-arm-eabi@npm:1.4.3": 326 | version: 1.4.3 327 | resolution: "@napi-rs/lzma-android-arm-eabi@npm:1.4.3" 328 | conditions: os=android & cpu=arm 329 | languageName: node 330 | linkType: hard 331 | 332 | "@napi-rs/lzma-android-arm64@npm:1.4.3": 333 | version: 1.4.3 334 | resolution: "@napi-rs/lzma-android-arm64@npm:1.4.3" 335 | conditions: os=android & cpu=arm64 336 | languageName: node 337 | linkType: hard 338 | 339 | "@napi-rs/lzma-darwin-arm64@npm:1.4.3": 340 | version: 1.4.3 341 | resolution: "@napi-rs/lzma-darwin-arm64@npm:1.4.3" 342 | conditions: os=darwin & cpu=arm64 343 | languageName: node 344 | linkType: hard 345 | 346 | "@napi-rs/lzma-darwin-x64@npm:1.4.3": 347 | version: 1.4.3 348 | resolution: "@napi-rs/lzma-darwin-x64@npm:1.4.3" 349 | conditions: os=darwin & cpu=x64 350 | languageName: node 351 | linkType: hard 352 | 353 | "@napi-rs/lzma-freebsd-x64@npm:1.4.3": 354 | version: 1.4.3 355 | resolution: "@napi-rs/lzma-freebsd-x64@npm:1.4.3" 356 | conditions: os=freebsd & cpu=x64 357 | languageName: node 358 | linkType: hard 359 | 360 | "@napi-rs/lzma-linux-arm-gnueabihf@npm:1.4.3": 361 | version: 1.4.3 362 | resolution: "@napi-rs/lzma-linux-arm-gnueabihf@npm:1.4.3" 363 | conditions: os=linux & cpu=arm 364 | languageName: node 365 | linkType: hard 366 | 367 | "@napi-rs/lzma-linux-arm64-gnu@npm:1.4.3": 368 | version: 1.4.3 369 | resolution: "@napi-rs/lzma-linux-arm64-gnu@npm:1.4.3" 370 | conditions: os=linux & cpu=arm64 & libc=glibc 371 | languageName: node 372 | linkType: hard 373 | 374 | "@napi-rs/lzma-linux-arm64-musl@npm:1.4.3": 375 | version: 1.4.3 376 | resolution: "@napi-rs/lzma-linux-arm64-musl@npm:1.4.3" 377 | conditions: os=linux & cpu=arm64 & libc=musl 378 | languageName: node 379 | linkType: hard 380 | 381 | "@napi-rs/lzma-linux-ppc64-gnu@npm:1.4.3": 382 | version: 1.4.3 383 | resolution: "@napi-rs/lzma-linux-ppc64-gnu@npm:1.4.3" 384 | conditions: os=linux & cpu=ppc64 & libc=glibc 385 | languageName: node 386 | linkType: hard 387 | 388 | "@napi-rs/lzma-linux-riscv64-gnu@npm:1.4.3": 389 | version: 1.4.3 390 | resolution: "@napi-rs/lzma-linux-riscv64-gnu@npm:1.4.3" 391 | conditions: os=linux & cpu=riscv64 & libc=glibc 392 | languageName: node 393 | linkType: hard 394 | 395 | "@napi-rs/lzma-linux-s390x-gnu@npm:1.4.3": 396 | version: 1.4.3 397 | resolution: "@napi-rs/lzma-linux-s390x-gnu@npm:1.4.3" 398 | conditions: os=linux & cpu=s390x & libc=glibc 399 | languageName: node 400 | linkType: hard 401 | 402 | "@napi-rs/lzma-linux-x64-gnu@npm:1.4.3": 403 | version: 1.4.3 404 | resolution: "@napi-rs/lzma-linux-x64-gnu@npm:1.4.3" 405 | conditions: os=linux & cpu=x64 & libc=glibc 406 | languageName: node 407 | linkType: hard 408 | 409 | "@napi-rs/lzma-linux-x64-musl@npm:1.4.3": 410 | version: 1.4.3 411 | resolution: "@napi-rs/lzma-linux-x64-musl@npm:1.4.3" 412 | conditions: os=linux & cpu=x64 & libc=musl 413 | languageName: node 414 | linkType: hard 415 | 416 | "@napi-rs/lzma-wasm32-wasi@npm:1.4.3": 417 | version: 1.4.3 418 | resolution: "@napi-rs/lzma-wasm32-wasi@npm:1.4.3" 419 | dependencies: 420 | "@napi-rs/wasm-runtime": "npm:^0.2.10" 421 | conditions: cpu=wasm32 422 | languageName: node 423 | linkType: hard 424 | 425 | "@napi-rs/lzma-win32-arm64-msvc@npm:1.4.3": 426 | version: 1.4.3 427 | resolution: "@napi-rs/lzma-win32-arm64-msvc@npm:1.4.3" 428 | conditions: os=win32 & cpu=arm64 429 | languageName: node 430 | linkType: hard 431 | 432 | "@napi-rs/lzma-win32-ia32-msvc@npm:1.4.3": 433 | version: 1.4.3 434 | resolution: "@napi-rs/lzma-win32-ia32-msvc@npm:1.4.3" 435 | conditions: os=win32 & cpu=ia32 436 | languageName: node 437 | linkType: hard 438 | 439 | "@napi-rs/lzma-win32-x64-msvc@npm:1.4.3": 440 | version: 1.4.3 441 | resolution: "@napi-rs/lzma-win32-x64-msvc@npm:1.4.3" 442 | conditions: os=win32 & cpu=x64 443 | languageName: node 444 | linkType: hard 445 | 446 | "@napi-rs/lzma@npm:^1.4.1": 447 | version: 1.4.3 448 | resolution: "@napi-rs/lzma@npm:1.4.3" 449 | dependencies: 450 | "@napi-rs/lzma-android-arm-eabi": "npm:1.4.3" 451 | "@napi-rs/lzma-android-arm64": "npm:1.4.3" 452 | "@napi-rs/lzma-darwin-arm64": "npm:1.4.3" 453 | "@napi-rs/lzma-darwin-x64": "npm:1.4.3" 454 | "@napi-rs/lzma-freebsd-x64": "npm:1.4.3" 455 | "@napi-rs/lzma-linux-arm-gnueabihf": "npm:1.4.3" 456 | "@napi-rs/lzma-linux-arm64-gnu": "npm:1.4.3" 457 | "@napi-rs/lzma-linux-arm64-musl": "npm:1.4.3" 458 | "@napi-rs/lzma-linux-ppc64-gnu": "npm:1.4.3" 459 | "@napi-rs/lzma-linux-riscv64-gnu": "npm:1.4.3" 460 | "@napi-rs/lzma-linux-s390x-gnu": "npm:1.4.3" 461 | "@napi-rs/lzma-linux-x64-gnu": "npm:1.4.3" 462 | "@napi-rs/lzma-linux-x64-musl": "npm:1.4.3" 463 | "@napi-rs/lzma-wasm32-wasi": "npm:1.4.3" 464 | "@napi-rs/lzma-win32-arm64-msvc": "npm:1.4.3" 465 | "@napi-rs/lzma-win32-ia32-msvc": "npm:1.4.3" 466 | "@napi-rs/lzma-win32-x64-msvc": "npm:1.4.3" 467 | dependenciesMeta: 468 | "@napi-rs/lzma-android-arm-eabi": 469 | optional: true 470 | "@napi-rs/lzma-android-arm64": 471 | optional: true 472 | "@napi-rs/lzma-darwin-arm64": 473 | optional: true 474 | "@napi-rs/lzma-darwin-x64": 475 | optional: true 476 | "@napi-rs/lzma-freebsd-x64": 477 | optional: true 478 | "@napi-rs/lzma-linux-arm-gnueabihf": 479 | optional: true 480 | "@napi-rs/lzma-linux-arm64-gnu": 481 | optional: true 482 | "@napi-rs/lzma-linux-arm64-musl": 483 | optional: true 484 | "@napi-rs/lzma-linux-ppc64-gnu": 485 | optional: true 486 | "@napi-rs/lzma-linux-riscv64-gnu": 487 | optional: true 488 | "@napi-rs/lzma-linux-s390x-gnu": 489 | optional: true 490 | "@napi-rs/lzma-linux-x64-gnu": 491 | optional: true 492 | "@napi-rs/lzma-linux-x64-musl": 493 | optional: true 494 | "@napi-rs/lzma-wasm32-wasi": 495 | optional: true 496 | "@napi-rs/lzma-win32-arm64-msvc": 497 | optional: true 498 | "@napi-rs/lzma-win32-ia32-msvc": 499 | optional: true 500 | "@napi-rs/lzma-win32-x64-msvc": 501 | optional: true 502 | checksum: 10c0/7a9453547c1a864a06b899df5d91e8dd46694edd405482a1f952f76c1ed9f907866179410f9e0a64c244bf24ae7ef70c629a6b7cab3cbf80d7ff88c5dc21c8c4 503 | languageName: node 504 | linkType: hard 505 | 506 | "@napi-rs/tar-android-arm-eabi@npm:0.1.5": 507 | version: 0.1.5 508 | resolution: "@napi-rs/tar-android-arm-eabi@npm:0.1.5" 509 | conditions: os=android & cpu=arm 510 | languageName: node 511 | linkType: hard 512 | 513 | "@napi-rs/tar-android-arm64@npm:0.1.5": 514 | version: 0.1.5 515 | resolution: "@napi-rs/tar-android-arm64@npm:0.1.5" 516 | conditions: os=android & cpu=arm64 517 | languageName: node 518 | linkType: hard 519 | 520 | "@napi-rs/tar-darwin-arm64@npm:0.1.5": 521 | version: 0.1.5 522 | resolution: "@napi-rs/tar-darwin-arm64@npm:0.1.5" 523 | conditions: os=darwin & cpu=arm64 524 | languageName: node 525 | linkType: hard 526 | 527 | "@napi-rs/tar-darwin-x64@npm:0.1.5": 528 | version: 0.1.5 529 | resolution: "@napi-rs/tar-darwin-x64@npm:0.1.5" 530 | conditions: os=darwin & cpu=x64 531 | languageName: node 532 | linkType: hard 533 | 534 | "@napi-rs/tar-freebsd-x64@npm:0.1.5": 535 | version: 0.1.5 536 | resolution: "@napi-rs/tar-freebsd-x64@npm:0.1.5" 537 | conditions: os=freebsd & cpu=x64 538 | languageName: node 539 | linkType: hard 540 | 541 | "@napi-rs/tar-linux-arm-gnueabihf@npm:0.1.5": 542 | version: 0.1.5 543 | resolution: "@napi-rs/tar-linux-arm-gnueabihf@npm:0.1.5" 544 | conditions: os=linux & cpu=arm 545 | languageName: node 546 | linkType: hard 547 | 548 | "@napi-rs/tar-linux-arm64-gnu@npm:0.1.5": 549 | version: 0.1.5 550 | resolution: "@napi-rs/tar-linux-arm64-gnu@npm:0.1.5" 551 | conditions: os=linux & cpu=arm64 & libc=glibc 552 | languageName: node 553 | linkType: hard 554 | 555 | "@napi-rs/tar-linux-arm64-musl@npm:0.1.5": 556 | version: 0.1.5 557 | resolution: "@napi-rs/tar-linux-arm64-musl@npm:0.1.5" 558 | conditions: os=linux & cpu=arm64 & libc=musl 559 | languageName: node 560 | linkType: hard 561 | 562 | "@napi-rs/tar-linux-ppc64-gnu@npm:0.1.5": 563 | version: 0.1.5 564 | resolution: "@napi-rs/tar-linux-ppc64-gnu@npm:0.1.5" 565 | conditions: os=linux & cpu=ppc64 & libc=glibc 566 | languageName: node 567 | linkType: hard 568 | 569 | "@napi-rs/tar-linux-s390x-gnu@npm:0.1.5": 570 | version: 0.1.5 571 | resolution: "@napi-rs/tar-linux-s390x-gnu@npm:0.1.5" 572 | conditions: os=linux & cpu=s390x & libc=glibc 573 | languageName: node 574 | linkType: hard 575 | 576 | "@napi-rs/tar-linux-x64-gnu@npm:0.1.5": 577 | version: 0.1.5 578 | resolution: "@napi-rs/tar-linux-x64-gnu@npm:0.1.5" 579 | conditions: os=linux & cpu=x64 & libc=glibc 580 | languageName: node 581 | linkType: hard 582 | 583 | "@napi-rs/tar-linux-x64-musl@npm:0.1.5": 584 | version: 0.1.5 585 | resolution: "@napi-rs/tar-linux-x64-musl@npm:0.1.5" 586 | conditions: os=linux & cpu=x64 & libc=musl 587 | languageName: node 588 | linkType: hard 589 | 590 | "@napi-rs/tar-wasm32-wasi@npm:0.1.5": 591 | version: 0.1.5 592 | resolution: "@napi-rs/tar-wasm32-wasi@npm:0.1.5" 593 | dependencies: 594 | "@napi-rs/wasm-runtime": "npm:^0.2.9" 595 | conditions: cpu=wasm32 596 | languageName: node 597 | linkType: hard 598 | 599 | "@napi-rs/tar-win32-arm64-msvc@npm:0.1.5": 600 | version: 0.1.5 601 | resolution: "@napi-rs/tar-win32-arm64-msvc@npm:0.1.5" 602 | conditions: os=win32 & cpu=arm64 603 | languageName: node 604 | linkType: hard 605 | 606 | "@napi-rs/tar-win32-ia32-msvc@npm:0.1.5": 607 | version: 0.1.5 608 | resolution: "@napi-rs/tar-win32-ia32-msvc@npm:0.1.5" 609 | conditions: os=win32 & cpu=ia32 610 | languageName: node 611 | linkType: hard 612 | 613 | "@napi-rs/tar-win32-x64-msvc@npm:0.1.5": 614 | version: 0.1.5 615 | resolution: "@napi-rs/tar-win32-x64-msvc@npm:0.1.5" 616 | conditions: os=win32 & cpu=x64 617 | languageName: node 618 | linkType: hard 619 | 620 | "@napi-rs/tar@npm:^0.1.4": 621 | version: 0.1.5 622 | resolution: "@napi-rs/tar@npm:0.1.5" 623 | dependencies: 624 | "@napi-rs/tar-android-arm-eabi": "npm:0.1.5" 625 | "@napi-rs/tar-android-arm64": "npm:0.1.5" 626 | "@napi-rs/tar-darwin-arm64": "npm:0.1.5" 627 | "@napi-rs/tar-darwin-x64": "npm:0.1.5" 628 | "@napi-rs/tar-freebsd-x64": "npm:0.1.5" 629 | "@napi-rs/tar-linux-arm-gnueabihf": "npm:0.1.5" 630 | "@napi-rs/tar-linux-arm64-gnu": "npm:0.1.5" 631 | "@napi-rs/tar-linux-arm64-musl": "npm:0.1.5" 632 | "@napi-rs/tar-linux-ppc64-gnu": "npm:0.1.5" 633 | "@napi-rs/tar-linux-s390x-gnu": "npm:0.1.5" 634 | "@napi-rs/tar-linux-x64-gnu": "npm:0.1.5" 635 | "@napi-rs/tar-linux-x64-musl": "npm:0.1.5" 636 | "@napi-rs/tar-wasm32-wasi": "npm:0.1.5" 637 | "@napi-rs/tar-win32-arm64-msvc": "npm:0.1.5" 638 | "@napi-rs/tar-win32-ia32-msvc": "npm:0.1.5" 639 | "@napi-rs/tar-win32-x64-msvc": "npm:0.1.5" 640 | dependenciesMeta: 641 | "@napi-rs/tar-android-arm-eabi": 642 | optional: true 643 | "@napi-rs/tar-android-arm64": 644 | optional: true 645 | "@napi-rs/tar-darwin-arm64": 646 | optional: true 647 | "@napi-rs/tar-darwin-x64": 648 | optional: true 649 | "@napi-rs/tar-freebsd-x64": 650 | optional: true 651 | "@napi-rs/tar-linux-arm-gnueabihf": 652 | optional: true 653 | "@napi-rs/tar-linux-arm64-gnu": 654 | optional: true 655 | "@napi-rs/tar-linux-arm64-musl": 656 | optional: true 657 | "@napi-rs/tar-linux-ppc64-gnu": 658 | optional: true 659 | "@napi-rs/tar-linux-s390x-gnu": 660 | optional: true 661 | "@napi-rs/tar-linux-x64-gnu": 662 | optional: true 663 | "@napi-rs/tar-linux-x64-musl": 664 | optional: true 665 | "@napi-rs/tar-wasm32-wasi": 666 | optional: true 667 | "@napi-rs/tar-win32-arm64-msvc": 668 | optional: true 669 | "@napi-rs/tar-win32-ia32-msvc": 670 | optional: true 671 | "@napi-rs/tar-win32-x64-msvc": 672 | optional: true 673 | checksum: 10c0/49f53a241ff5106739d49d29be7f25d54a421334dc1140806ea412aff6882761706e77f5e66bf1bf8df1a13fd9cd10ae4c2a8552a87a1aee7c3a5b930eb93221 674 | languageName: node 675 | linkType: hard 676 | 677 | "@napi-rs/wasm-runtime@npm:^0.2.10, @napi-rs/wasm-runtime@npm:^0.2.7, @napi-rs/wasm-runtime@npm:^0.2.9": 678 | version: 0.2.11 679 | resolution: "@napi-rs/wasm-runtime@npm:0.2.11" 680 | dependencies: 681 | "@emnapi/core": "npm:^1.4.3" 682 | "@emnapi/runtime": "npm:^1.4.3" 683 | "@tybys/wasm-util": "npm:^0.9.0" 684 | checksum: 10c0/049bd14c58b99fbe0967b95e9921c5503df196b59be22948d2155f17652eb305cff6728efd8685338b855da7e476dd2551fbe3a313fc2d810938f0717478441e 685 | languageName: node 686 | linkType: hard 687 | 688 | "@napi-rs/wasm-tools-android-arm-eabi@npm:0.0.3": 689 | version: 0.0.3 690 | resolution: "@napi-rs/wasm-tools-android-arm-eabi@npm:0.0.3" 691 | conditions: os=android & cpu=arm 692 | languageName: node 693 | linkType: hard 694 | 695 | "@napi-rs/wasm-tools-android-arm64@npm:0.0.3": 696 | version: 0.0.3 697 | resolution: "@napi-rs/wasm-tools-android-arm64@npm:0.0.3" 698 | conditions: os=android & cpu=arm64 699 | languageName: node 700 | linkType: hard 701 | 702 | "@napi-rs/wasm-tools-darwin-arm64@npm:0.0.3": 703 | version: 0.0.3 704 | resolution: "@napi-rs/wasm-tools-darwin-arm64@npm:0.0.3" 705 | conditions: os=darwin & cpu=arm64 706 | languageName: node 707 | linkType: hard 708 | 709 | "@napi-rs/wasm-tools-darwin-x64@npm:0.0.3": 710 | version: 0.0.3 711 | resolution: "@napi-rs/wasm-tools-darwin-x64@npm:0.0.3" 712 | conditions: os=darwin & cpu=x64 713 | languageName: node 714 | linkType: hard 715 | 716 | "@napi-rs/wasm-tools-freebsd-x64@npm:0.0.3": 717 | version: 0.0.3 718 | resolution: "@napi-rs/wasm-tools-freebsd-x64@npm:0.0.3" 719 | conditions: os=freebsd & cpu=x64 720 | languageName: node 721 | linkType: hard 722 | 723 | "@napi-rs/wasm-tools-linux-arm64-gnu@npm:0.0.3": 724 | version: 0.0.3 725 | resolution: "@napi-rs/wasm-tools-linux-arm64-gnu@npm:0.0.3" 726 | conditions: os=linux & cpu=arm64 & libc=glibc 727 | languageName: node 728 | linkType: hard 729 | 730 | "@napi-rs/wasm-tools-linux-arm64-musl@npm:0.0.3": 731 | version: 0.0.3 732 | resolution: "@napi-rs/wasm-tools-linux-arm64-musl@npm:0.0.3" 733 | conditions: os=linux & cpu=arm64 & libc=musl 734 | languageName: node 735 | linkType: hard 736 | 737 | "@napi-rs/wasm-tools-linux-x64-gnu@npm:0.0.3": 738 | version: 0.0.3 739 | resolution: "@napi-rs/wasm-tools-linux-x64-gnu@npm:0.0.3" 740 | conditions: os=linux & cpu=x64 & libc=glibc 741 | languageName: node 742 | linkType: hard 743 | 744 | "@napi-rs/wasm-tools-linux-x64-musl@npm:0.0.3": 745 | version: 0.0.3 746 | resolution: "@napi-rs/wasm-tools-linux-x64-musl@npm:0.0.3" 747 | conditions: os=linux & cpu=x64 & libc=musl 748 | languageName: node 749 | linkType: hard 750 | 751 | "@napi-rs/wasm-tools-wasm32-wasi@npm:0.0.3": 752 | version: 0.0.3 753 | resolution: "@napi-rs/wasm-tools-wasm32-wasi@npm:0.0.3" 754 | dependencies: 755 | "@napi-rs/wasm-runtime": "npm:^0.2.7" 756 | conditions: cpu=wasm32 757 | languageName: node 758 | linkType: hard 759 | 760 | "@napi-rs/wasm-tools-win32-arm64-msvc@npm:0.0.3": 761 | version: 0.0.3 762 | resolution: "@napi-rs/wasm-tools-win32-arm64-msvc@npm:0.0.3" 763 | conditions: os=win32 & cpu=arm64 764 | languageName: node 765 | linkType: hard 766 | 767 | "@napi-rs/wasm-tools-win32-ia32-msvc@npm:0.0.3": 768 | version: 0.0.3 769 | resolution: "@napi-rs/wasm-tools-win32-ia32-msvc@npm:0.0.3" 770 | conditions: os=win32 & cpu=ia32 771 | languageName: node 772 | linkType: hard 773 | 774 | "@napi-rs/wasm-tools-win32-x64-msvc@npm:0.0.3": 775 | version: 0.0.3 776 | resolution: "@napi-rs/wasm-tools-win32-x64-msvc@npm:0.0.3" 777 | conditions: os=win32 & cpu=x64 778 | languageName: node 779 | linkType: hard 780 | 781 | "@napi-rs/wasm-tools@npm:^0.0.3": 782 | version: 0.0.3 783 | resolution: "@napi-rs/wasm-tools@npm:0.0.3" 784 | dependencies: 785 | "@napi-rs/wasm-tools-android-arm-eabi": "npm:0.0.3" 786 | "@napi-rs/wasm-tools-android-arm64": "npm:0.0.3" 787 | "@napi-rs/wasm-tools-darwin-arm64": "npm:0.0.3" 788 | "@napi-rs/wasm-tools-darwin-x64": "npm:0.0.3" 789 | "@napi-rs/wasm-tools-freebsd-x64": "npm:0.0.3" 790 | "@napi-rs/wasm-tools-linux-arm64-gnu": "npm:0.0.3" 791 | "@napi-rs/wasm-tools-linux-arm64-musl": "npm:0.0.3" 792 | "@napi-rs/wasm-tools-linux-x64-gnu": "npm:0.0.3" 793 | "@napi-rs/wasm-tools-linux-x64-musl": "npm:0.0.3" 794 | "@napi-rs/wasm-tools-wasm32-wasi": "npm:0.0.3" 795 | "@napi-rs/wasm-tools-win32-arm64-msvc": "npm:0.0.3" 796 | "@napi-rs/wasm-tools-win32-ia32-msvc": "npm:0.0.3" 797 | "@napi-rs/wasm-tools-win32-x64-msvc": "npm:0.0.3" 798 | dependenciesMeta: 799 | "@napi-rs/wasm-tools-android-arm-eabi": 800 | optional: true 801 | "@napi-rs/wasm-tools-android-arm64": 802 | optional: true 803 | "@napi-rs/wasm-tools-darwin-arm64": 804 | optional: true 805 | "@napi-rs/wasm-tools-darwin-x64": 806 | optional: true 807 | "@napi-rs/wasm-tools-freebsd-x64": 808 | optional: true 809 | "@napi-rs/wasm-tools-linux-arm64-gnu": 810 | optional: true 811 | "@napi-rs/wasm-tools-linux-arm64-musl": 812 | optional: true 813 | "@napi-rs/wasm-tools-linux-x64-gnu": 814 | optional: true 815 | "@napi-rs/wasm-tools-linux-x64-musl": 816 | optional: true 817 | "@napi-rs/wasm-tools-wasm32-wasi": 818 | optional: true 819 | "@napi-rs/wasm-tools-win32-arm64-msvc": 820 | optional: true 821 | "@napi-rs/wasm-tools-win32-ia32-msvc": 822 | optional: true 823 | "@napi-rs/wasm-tools-win32-x64-msvc": 824 | optional: true 825 | checksum: 10c0/ad0cf8ea9462a2fb6837666d1fdb4797089176ad8e6838f8fca4326f1f222a136380a4ce8e4366efa26febb0e3404ccb1890314f92751b274a93001368f70fcc 826 | languageName: node 827 | linkType: hard 828 | 829 | "@octokit/auth-token@npm:^6.0.0": 830 | version: 6.0.0 831 | resolution: "@octokit/auth-token@npm:6.0.0" 832 | checksum: 10c0/32ecc904c5f6f4e5d090bfcc679d70318690c0a0b5040cd9a25811ad9dcd44c33f2cf96b6dbee1cd56cf58fde28fb1819c01b58718aa5c971f79c822357cb5c0 833 | languageName: node 834 | linkType: hard 835 | 836 | "@octokit/core@npm:^7.0.2": 837 | version: 7.0.2 838 | resolution: "@octokit/core@npm:7.0.2" 839 | dependencies: 840 | "@octokit/auth-token": "npm:^6.0.0" 841 | "@octokit/graphql": "npm:^9.0.1" 842 | "@octokit/request": "npm:^10.0.2" 843 | "@octokit/request-error": "npm:^7.0.0" 844 | "@octokit/types": "npm:^14.0.0" 845 | before-after-hook: "npm:^4.0.0" 846 | universal-user-agent: "npm:^7.0.0" 847 | checksum: 10c0/845a6ff07fcf307b4eab29119123cba698b9edcf93539a8cb4fc99b7e041573ac047d50b30cf7ebbe368fc18b29cdb9f30fdfcffb26267492d7c767d100fc25f 848 | languageName: node 849 | linkType: hard 850 | 851 | "@octokit/endpoint@npm:^11.0.0": 852 | version: 11.0.0 853 | resolution: "@octokit/endpoint@npm:11.0.0" 854 | dependencies: 855 | "@octokit/types": "npm:^14.0.0" 856 | universal-user-agent: "npm:^7.0.2" 857 | checksum: 10c0/ba929128af5327393fdb3a31f416277ae3036a44566d35955a4eddd484a15b5ddc6abe219a56355f3313c7197d59f4e8bf574a4f0a8680bc1c8725b88433d391 858 | languageName: node 859 | linkType: hard 860 | 861 | "@octokit/graphql@npm:^9.0.1": 862 | version: 9.0.1 863 | resolution: "@octokit/graphql@npm:9.0.1" 864 | dependencies: 865 | "@octokit/request": "npm:^10.0.2" 866 | "@octokit/types": "npm:^14.0.0" 867 | universal-user-agent: "npm:^7.0.0" 868 | checksum: 10c0/d80ec923b7624e8a7c84430a287ff18da3c77058e3166ce8e9a67950af00e88767f85d973b4032fc837b67b72d02b323aff2d8f7eeae1ae463bde1a51ddcb83d 869 | languageName: node 870 | linkType: hard 871 | 872 | "@octokit/openapi-types@npm:^25.1.0": 873 | version: 25.1.0 874 | resolution: "@octokit/openapi-types@npm:25.1.0" 875 | checksum: 10c0/b5b1293b11c6ec7112c7a2713f8507c2696d5db8902ce893b594080ab0329f5a6fcda1b5ac6fe6eed9425e897f4d03326c1bdf5c337e35d324e7b925e52a2661 876 | languageName: node 877 | linkType: hard 878 | 879 | "@octokit/plugin-paginate-rest@npm:^13.0.1": 880 | version: 13.1.1 881 | resolution: "@octokit/plugin-paginate-rest@npm:13.1.1" 882 | dependencies: 883 | "@octokit/types": "npm:^14.1.0" 884 | peerDependencies: 885 | "@octokit/core": ">=6" 886 | checksum: 10c0/88d80608881df88f8e832856e9279ac1c1af30ced9adb7c847f4d120b4bb308c2ab9d791ffd4c9585759e57a938798b4c3f2f988a389f2d78a61aaaebc36ffa7 887 | languageName: node 888 | linkType: hard 889 | 890 | "@octokit/plugin-request-log@npm:^6.0.0": 891 | version: 6.0.0 892 | resolution: "@octokit/plugin-request-log@npm:6.0.0" 893 | peerDependencies: 894 | "@octokit/core": ">=6" 895 | checksum: 10c0/40e46ad0c77235742d0bf698ab4e17df1ae06e0d7824ffc5867ed71e27de860875adb73d89629b823fe8647459a8f262c26ed1aa6ee374873fa94095f37df0bb 896 | languageName: node 897 | linkType: hard 898 | 899 | "@octokit/plugin-rest-endpoint-methods@npm:^16.0.0": 900 | version: 16.0.0 901 | resolution: "@octokit/plugin-rest-endpoint-methods@npm:16.0.0" 902 | dependencies: 903 | "@octokit/types": "npm:^14.1.0" 904 | peerDependencies: 905 | "@octokit/core": ">=6" 906 | checksum: 10c0/6cfe068dbd550bd5914374e65b89482b9deac29f6c26bf02ab6298e956d95b62fc15a2a49dfc6ff76f5938c6ff7fdfe5b7eccdb7551eaff8b1daf7394bc946cb 907 | languageName: node 908 | linkType: hard 909 | 910 | "@octokit/request-error@npm:^7.0.0": 911 | version: 7.0.0 912 | resolution: "@octokit/request-error@npm:7.0.0" 913 | dependencies: 914 | "@octokit/types": "npm:^14.0.0" 915 | checksum: 10c0/e52bdd832a0187d66b20da5716c374d028f63d824908a9e16cad462754324083839b11cf6956e1d23f6112d3c77f17334ebbd80f49d56840b2b03ed9abef8cb0 916 | languageName: node 917 | linkType: hard 918 | 919 | "@octokit/request@npm:^10.0.2": 920 | version: 10.0.3 921 | resolution: "@octokit/request@npm:10.0.3" 922 | dependencies: 923 | "@octokit/endpoint": "npm:^11.0.0" 924 | "@octokit/request-error": "npm:^7.0.0" 925 | "@octokit/types": "npm:^14.0.0" 926 | fast-content-type-parse: "npm:^3.0.0" 927 | universal-user-agent: "npm:^7.0.2" 928 | checksum: 10c0/2d9b2134390ef3aa9fe0c5e659fe93dd94fbabc4dcc6da6e16998dc84b5bda200e6b7a4e178f567883d0ba99c0ea5a6d095a417d86d76854569196c39d2f9a6d 929 | languageName: node 930 | linkType: hard 931 | 932 | "@octokit/rest@npm:^22.0.0": 933 | version: 22.0.0 934 | resolution: "@octokit/rest@npm:22.0.0" 935 | dependencies: 936 | "@octokit/core": "npm:^7.0.2" 937 | "@octokit/plugin-paginate-rest": "npm:^13.0.1" 938 | "@octokit/plugin-request-log": "npm:^6.0.0" 939 | "@octokit/plugin-rest-endpoint-methods": "npm:^16.0.0" 940 | checksum: 10c0/aea3714301f43fbadb22048045a7aef417cdefa997d1baf0b26860eaa9038fb033f7d4299eab06af57a03433871084cf38144fc5414caf80accce714e76d34e2 941 | languageName: node 942 | linkType: hard 943 | 944 | "@octokit/types@npm:^14.0.0, @octokit/types@npm:^14.1.0": 945 | version: 14.1.0 946 | resolution: "@octokit/types@npm:14.1.0" 947 | dependencies: 948 | "@octokit/openapi-types": "npm:^25.1.0" 949 | checksum: 10c0/4640a6c0a95386be4d015b96c3a906756ea657f7df3c6e706d19fea6bf3ac44fd2991c8c817afe1e670ff9042b85b0e06f7fd373f6bbd47da64208701bb46d5b 950 | languageName: node 951 | linkType: hard 952 | 953 | "@tybys/wasm-util@npm:^0.9.0": 954 | version: 0.9.0 955 | resolution: "@tybys/wasm-util@npm:0.9.0" 956 | dependencies: 957 | tslib: "npm:^2.4.0" 958 | checksum: 10c0/f9fde5c554455019f33af6c8215f1a1435028803dc2a2825b077d812bed4209a1a64444a4ca0ce2ea7e1175c8d88e2f9173a36a33c199e8a5c671aa31de8242d 959 | languageName: node 960 | linkType: hard 961 | 962 | "ansi-escapes@npm:^4.3.2": 963 | version: 4.3.2 964 | resolution: "ansi-escapes@npm:4.3.2" 965 | dependencies: 966 | type-fest: "npm:^0.21.3" 967 | checksum: 10c0/da917be01871525a3dfcf925ae2977bc59e8c513d4423368645634bf5d4ceba5401574eb705c1e92b79f7292af5a656f78c5725a4b0e1cec97c4b413705c1d50 968 | languageName: node 969 | linkType: hard 970 | 971 | "ansi-regex@npm:^5.0.1": 972 | version: 5.0.1 973 | resolution: "ansi-regex@npm:5.0.1" 974 | checksum: 10c0/9a64bb8627b434ba9327b60c027742e5d17ac69277960d041898596271d992d4d52ba7267a63ca10232e29f6107fc8a835f6ce8d719b88c5f8493f8254813737 975 | languageName: node 976 | linkType: hard 977 | 978 | "ansi-styles@npm:^4.0.0": 979 | version: 4.3.0 980 | resolution: "ansi-styles@npm:4.3.0" 981 | dependencies: 982 | color-convert: "npm:^2.0.1" 983 | checksum: 10c0/895a23929da416f2bd3de7e9cb4eabd340949328ab85ddd6e484a637d8f6820d485f53933446f5291c3b760cbc488beb8e88573dd0f9c7daf83dccc8fe81b041 984 | languageName: node 985 | linkType: hard 986 | 987 | "argparse@npm:^2.0.1": 988 | version: 2.0.1 989 | resolution: "argparse@npm:2.0.1" 990 | checksum: 10c0/c5640c2d89045371c7cedd6a70212a04e360fd34d6edeae32f6952c63949e3525ea77dbec0289d8213a99bbaeab5abfa860b5c12cf88a2e6cf8106e90dd27a7e 991 | languageName: node 992 | linkType: hard 993 | 994 | "before-after-hook@npm:^4.0.0": 995 | version: 4.0.0 996 | resolution: "before-after-hook@npm:4.0.0" 997 | checksum: 10c0/9f8ae8d1b06142bcfb9ef6625226b5e50348bb11210f266660eddcf9734e0db6f9afc4cb48397ee3f5ac0a3728f3ae401cdeea88413f7bed748a71db84657be2 998 | languageName: node 999 | linkType: hard 1000 | 1001 | "chardet@npm:^0.7.0": 1002 | version: 0.7.0 1003 | resolution: "chardet@npm:0.7.0" 1004 | checksum: 10c0/96e4731b9ec8050cbb56ab684e8c48d6c33f7826b755802d14e3ebfdc51c57afeece3ea39bc6b09acc359e4363525388b915e16640c1378053820f5e70d0f27d 1005 | languageName: node 1006 | linkType: hard 1007 | 1008 | "cli-width@npm:^4.1.0": 1009 | version: 4.1.0 1010 | resolution: "cli-width@npm:4.1.0" 1011 | checksum: 10c0/1fbd56413578f6117abcaf858903ba1f4ad78370a4032f916745fa2c7e390183a9d9029cf837df320b0fdce8137668e522f60a30a5f3d6529ff3872d265a955f 1012 | languageName: node 1013 | linkType: hard 1014 | 1015 | "clipanion@npm:^4.0.0-rc.4": 1016 | version: 4.0.0-rc.4 1017 | resolution: "clipanion@npm:4.0.0-rc.4" 1018 | dependencies: 1019 | typanion: "npm:^3.8.0" 1020 | peerDependencies: 1021 | typanion: "*" 1022 | checksum: 10c0/047b415b59a5e9777d00690fba563ccc850eca6bf27790a88d1deea3ecc8a89840ae9aed554ff284cc698a9f3f20256e43c25ff4a7c4c90a71e5e7d9dca61dd1 1023 | languageName: node 1024 | linkType: hard 1025 | 1026 | "color-convert@npm:^2.0.1": 1027 | version: 2.0.1 1028 | resolution: "color-convert@npm:2.0.1" 1029 | dependencies: 1030 | color-name: "npm:~1.1.4" 1031 | checksum: 10c0/37e1150172f2e311fe1b2df62c6293a342ee7380da7b9cfdba67ea539909afbd74da27033208d01d6d5cfc65ee7868a22e18d7e7648e004425441c0f8a15a7d7 1032 | languageName: node 1033 | linkType: hard 1034 | 1035 | "color-name@npm:~1.1.4": 1036 | version: 1.1.4 1037 | resolution: "color-name@npm:1.1.4" 1038 | checksum: 10c0/a1a3f914156960902f46f7f56bc62effc6c94e84b2cae157a526b1c1f74b677a47ec602bf68a61abfa2b42d15b7c5651c6dbe72a43af720bc588dff885b10f95 1039 | languageName: node 1040 | linkType: hard 1041 | 1042 | "colorette@npm:^2.0.20": 1043 | version: 2.0.20 1044 | resolution: "colorette@npm:2.0.20" 1045 | checksum: 10c0/e94116ff33b0ff56f3b83b9ace895e5bf87c2a7a47b3401b8c3f3226e050d5ef76cf4072fb3325f9dc24d1698f9b730baf4e05eeaf861d74a1883073f4c98a40 1046 | languageName: node 1047 | linkType: hard 1048 | 1049 | "debug@npm:^4.4.0": 1050 | version: 4.4.1 1051 | resolution: "debug@npm:4.4.1" 1052 | dependencies: 1053 | ms: "npm:^2.1.3" 1054 | peerDependenciesMeta: 1055 | supports-color: 1056 | optional: true 1057 | checksum: 10c0/d2b44bc1afd912b49bb7ebb0d50a860dc93a4dd7d946e8de94abc957bb63726b7dd5aa48c18c2386c379ec024c46692e15ed3ed97d481729f929201e671fcd55 1058 | languageName: node 1059 | linkType: hard 1060 | 1061 | "emnapi@npm:^1.4.0": 1062 | version: 1.4.4 1063 | resolution: "emnapi@npm:1.4.4" 1064 | peerDependencies: 1065 | node-addon-api: ">= 6.1.0" 1066 | peerDependenciesMeta: 1067 | node-addon-api: 1068 | optional: true 1069 | checksum: 10c0/4f722f794a08d62ca1e84770084ce9b6e40cd06d028ed5350cc4eb6ed0294933a04aefc70fa3f36beed6f75fd77dcaeae8203ad73c5403f445e1587291ff1bd1 1070 | languageName: node 1071 | linkType: hard 1072 | 1073 | "emoji-regex@npm:^8.0.0": 1074 | version: 8.0.0 1075 | resolution: "emoji-regex@npm:8.0.0" 1076 | checksum: 10c0/b6053ad39951c4cf338f9092d7bfba448cdfd46fe6a2a034700b149ac9ffbc137e361cbd3c442297f86bed2e5f7576c1b54cc0a6bf8ef5106cc62f496af35010 1077 | languageName: node 1078 | linkType: hard 1079 | 1080 | "external-editor@npm:^3.1.0": 1081 | version: 3.1.0 1082 | resolution: "external-editor@npm:3.1.0" 1083 | dependencies: 1084 | chardet: "npm:^0.7.0" 1085 | iconv-lite: "npm:^0.4.24" 1086 | tmp: "npm:^0.0.33" 1087 | checksum: 10c0/c98f1ba3efdfa3c561db4447ff366a6adb5c1e2581462522c56a18bf90dfe4da382f9cd1feee3e330108c3595a854b218272539f311ba1b3298f841eb0fbf339 1088 | languageName: node 1089 | linkType: hard 1090 | 1091 | "fast-content-type-parse@npm:^3.0.0": 1092 | version: 3.0.0 1093 | resolution: "fast-content-type-parse@npm:3.0.0" 1094 | checksum: 10c0/06251880c83b7118af3a5e66e8bcee60d44f48b39396fc60acc2b4630bd5f3e77552b999b5c8e943d45a818854360e5e97164c374ec4b562b4df96a2cdf2e188 1095 | languageName: node 1096 | linkType: hard 1097 | 1098 | "find-up@npm:^7.0.0": 1099 | version: 7.0.0 1100 | resolution: "find-up@npm:7.0.0" 1101 | dependencies: 1102 | locate-path: "npm:^7.2.0" 1103 | path-exists: "npm:^5.0.0" 1104 | unicorn-magic: "npm:^0.1.0" 1105 | checksum: 10c0/e6ee3e6154560bc0ab3bc3b7d1348b31513f9bdf49a5dd2e952495427d559fa48cdf33953e85a309a323898b43fa1bfbc8b80c880dfc16068384783034030008 1106 | languageName: node 1107 | linkType: hard 1108 | 1109 | "iconv-lite@npm:^0.4.24": 1110 | version: 0.4.24 1111 | resolution: "iconv-lite@npm:0.4.24" 1112 | dependencies: 1113 | safer-buffer: "npm:>= 2.1.2 < 3" 1114 | checksum: 10c0/c6886a24cc00f2a059767440ec1bc00d334a89f250db8e0f7feb4961c8727118457e27c495ba94d082e51d3baca378726cd110aaf7ded8b9bbfd6a44760cf1d4 1115 | languageName: node 1116 | linkType: hard 1117 | 1118 | "is-fullwidth-code-point@npm:^3.0.0": 1119 | version: 3.0.0 1120 | resolution: "is-fullwidth-code-point@npm:3.0.0" 1121 | checksum: 10c0/bb11d825e049f38e04c06373a8d72782eee0205bda9d908cc550ccb3c59b99d750ff9537982e01733c1c94a58e35400661f57042158ff5e8f3e90cf936daf0fc 1122 | languageName: node 1123 | linkType: hard 1124 | 1125 | "js-yaml@npm:^4.1.0": 1126 | version: 4.1.0 1127 | resolution: "js-yaml@npm:4.1.0" 1128 | dependencies: 1129 | argparse: "npm:^2.0.1" 1130 | bin: 1131 | js-yaml: bin/js-yaml.js 1132 | checksum: 10c0/184a24b4eaacfce40ad9074c64fd42ac83cf74d8c8cd137718d456ced75051229e5061b8633c3366b8aada17945a7a356b337828c19da92b51ae62126575018f 1133 | languageName: node 1134 | linkType: hard 1135 | 1136 | "locate-path@npm:^7.2.0": 1137 | version: 7.2.0 1138 | resolution: "locate-path@npm:7.2.0" 1139 | dependencies: 1140 | p-locate: "npm:^6.0.0" 1141 | checksum: 10c0/139e8a7fe11cfbd7f20db03923cacfa5db9e14fa14887ea121345597472b4a63c1a42a8a5187defeeff6acf98fd568da7382aa39682d38f0af27433953a97751 1142 | languageName: node 1143 | linkType: hard 1144 | 1145 | "lodash-es@npm:^4.17.21": 1146 | version: 4.17.21 1147 | resolution: "lodash-es@npm:4.17.21" 1148 | checksum: 10c0/fb407355f7e6cd523a9383e76e6b455321f0f153a6c9625e21a8827d10c54c2a2341bd2ae8d034358b60e07325e1330c14c224ff582d04612a46a4f0479ff2f2 1149 | languageName: node 1150 | linkType: hard 1151 | 1152 | "mimalloc-example@workspace:.": 1153 | version: 0.0.0-use.local 1154 | resolution: "mimalloc-example@workspace:." 1155 | dependencies: 1156 | "@napi-rs/cli": "npm:canary" 1157 | languageName: unknown 1158 | linkType: soft 1159 | 1160 | "ms@npm:^2.1.3": 1161 | version: 2.1.3 1162 | resolution: "ms@npm:2.1.3" 1163 | checksum: 10c0/d924b57e7312b3b63ad21fc5b3dc0af5e78d61a1fc7cfb5457edaf26326bf62be5307cc87ffb6862ef1c2b33b0233cdb5d4f01c4c958cc0d660948b65a287a48 1164 | languageName: node 1165 | linkType: hard 1166 | 1167 | "mute-stream@npm:^2.0.0": 1168 | version: 2.0.0 1169 | resolution: "mute-stream@npm:2.0.0" 1170 | checksum: 10c0/2cf48a2087175c60c8dcdbc619908b49c07f7adcfc37d29236b0c5c612d6204f789104c98cc44d38acab7b3c96f4a3ec2cfdc4934d0738d876dbefa2a12c69f4 1171 | languageName: node 1172 | linkType: hard 1173 | 1174 | "os-tmpdir@npm:~1.0.2": 1175 | version: 1.0.2 1176 | resolution: "os-tmpdir@npm:1.0.2" 1177 | checksum: 10c0/f438450224f8e2687605a8dd318f0db694b6293c5d835ae509a69e97c8de38b6994645337e5577f5001115470414638978cc49da1cdcc25106dad8738dc69990 1178 | languageName: node 1179 | linkType: hard 1180 | 1181 | "p-limit@npm:^4.0.0": 1182 | version: 4.0.0 1183 | resolution: "p-limit@npm:4.0.0" 1184 | dependencies: 1185 | yocto-queue: "npm:^1.0.0" 1186 | checksum: 10c0/a56af34a77f8df2ff61ddfb29431044557fcbcb7642d5a3233143ebba805fc7306ac1d448de724352861cb99de934bc9ab74f0d16fe6a5460bdbdf938de875ad 1187 | languageName: node 1188 | linkType: hard 1189 | 1190 | "p-locate@npm:^6.0.0": 1191 | version: 6.0.0 1192 | resolution: "p-locate@npm:6.0.0" 1193 | dependencies: 1194 | p-limit: "npm:^4.0.0" 1195 | checksum: 10c0/d72fa2f41adce59c198270aa4d3c832536c87a1806e0f69dffb7c1a7ca998fb053915ca833d90f166a8c082d3859eabfed95f01698a3214c20df6bb8de046312 1196 | languageName: node 1197 | linkType: hard 1198 | 1199 | "path-exists@npm:^5.0.0": 1200 | version: 5.0.0 1201 | resolution: "path-exists@npm:5.0.0" 1202 | checksum: 10c0/b170f3060b31604cde93eefdb7392b89d832dfbc1bed717c9718cbe0f230c1669b7e75f87e19901da2250b84d092989a0f9e44d2ef41deb09aa3ad28e691a40a 1203 | languageName: node 1204 | linkType: hard 1205 | 1206 | "safer-buffer@npm:>= 2.1.2 < 3": 1207 | version: 2.1.2 1208 | resolution: "safer-buffer@npm:2.1.2" 1209 | checksum: 10c0/7e3c8b2e88a1841c9671094bbaeebd94448111dd90a81a1f606f3f67708a6ec57763b3b47f06da09fc6054193e0e6709e77325415dc8422b04497a8070fa02d4 1210 | languageName: node 1211 | linkType: hard 1212 | 1213 | "semver@npm:^7.7.1": 1214 | version: 7.7.2 1215 | resolution: "semver@npm:7.7.2" 1216 | bin: 1217 | semver: bin/semver.js 1218 | checksum: 10c0/aca305edfbf2383c22571cb7714f48cadc7ac95371b4b52362fb8eeffdfbc0de0669368b82b2b15978f8848f01d7114da65697e56cd8c37b0dab8c58e543f9ea 1219 | languageName: node 1220 | linkType: hard 1221 | 1222 | "signal-exit@npm:^4.1.0": 1223 | version: 4.1.0 1224 | resolution: "signal-exit@npm:4.1.0" 1225 | checksum: 10c0/41602dce540e46d599edba9d9860193398d135f7ff72cab629db5171516cfae628d21e7bfccde1bbfdf11c48726bc2a6d1a8fb8701125852fbfda7cf19c6aa83 1226 | languageName: node 1227 | linkType: hard 1228 | 1229 | "string-width@npm:^4.1.0": 1230 | version: 4.2.3 1231 | resolution: "string-width@npm:4.2.3" 1232 | dependencies: 1233 | emoji-regex: "npm:^8.0.0" 1234 | is-fullwidth-code-point: "npm:^3.0.0" 1235 | strip-ansi: "npm:^6.0.1" 1236 | checksum: 10c0/1e525e92e5eae0afd7454086eed9c818ee84374bb80328fc41217ae72ff5f065ef1c9d7f72da41de40c75fa8bb3dee63d92373fd492c84260a552c636392a47b 1237 | languageName: node 1238 | linkType: hard 1239 | 1240 | "strip-ansi@npm:^6.0.0, strip-ansi@npm:^6.0.1": 1241 | version: 6.0.1 1242 | resolution: "strip-ansi@npm:6.0.1" 1243 | dependencies: 1244 | ansi-regex: "npm:^5.0.1" 1245 | checksum: 10c0/1ae5f212a126fe5b167707f716942490e3933085a5ff6c008ab97ab2f272c8025d3aa218b7bd6ab25729ca20cc81cddb252102f8751e13482a5199e873680952 1246 | languageName: node 1247 | linkType: hard 1248 | 1249 | "tmp@npm:^0.0.33": 1250 | version: 0.0.33 1251 | resolution: "tmp@npm:0.0.33" 1252 | dependencies: 1253 | os-tmpdir: "npm:~1.0.2" 1254 | checksum: 10c0/69863947b8c29cabad43fe0ce65cec5bb4b481d15d4b4b21e036b060b3edbf3bc7a5541de1bacb437bb3f7c4538f669752627fdf9b4aaf034cebd172ba373408 1255 | languageName: node 1256 | linkType: hard 1257 | 1258 | "tslib@npm:^2.4.0": 1259 | version: 2.8.1 1260 | resolution: "tslib@npm:2.8.1" 1261 | checksum: 10c0/9c4759110a19c53f992d9aae23aac5ced636e99887b51b9e61def52611732872ff7668757d4e4c61f19691e36f4da981cd9485e869b4a7408d689f6bf1f14e62 1262 | languageName: node 1263 | linkType: hard 1264 | 1265 | "typanion@npm:^3.14.0, typanion@npm:^3.8.0": 1266 | version: 3.14.0 1267 | resolution: "typanion@npm:3.14.0" 1268 | checksum: 10c0/8b03b19844e6955bfd906c31dc781bae6d7f1fb3ce4fe24b7501557013d4889ae5cefe671dafe98d87ead0adceb8afcb8bc16df7dc0bd2b7331bac96f3a7cae2 1269 | languageName: node 1270 | linkType: hard 1271 | 1272 | "type-fest@npm:^0.21.3": 1273 | version: 0.21.3 1274 | resolution: "type-fest@npm:0.21.3" 1275 | checksum: 10c0/902bd57bfa30d51d4779b641c2bc403cdf1371fb9c91d3c058b0133694fcfdb817aef07a47f40faf79039eecbaa39ee9d3c532deff244f3a19ce68cea71a61e8 1276 | languageName: node 1277 | linkType: hard 1278 | 1279 | "unicorn-magic@npm:^0.1.0": 1280 | version: 0.1.0 1281 | resolution: "unicorn-magic@npm:0.1.0" 1282 | checksum: 10c0/e4ed0de05b0a05e735c7d8a2930881e5efcfc3ec897204d5d33e7e6247f4c31eac92e383a15d9a6bccb7319b4271ee4bea946e211bf14951fec6ff2cbbb66a92 1283 | languageName: node 1284 | linkType: hard 1285 | 1286 | "universal-user-agent@npm:^7.0.0, universal-user-agent@npm:^7.0.2": 1287 | version: 7.0.3 1288 | resolution: "universal-user-agent@npm:7.0.3" 1289 | checksum: 10c0/6043be466a9bb96c0ce82392842d9fddf4c37e296f7bacc2cb25f47123990eb436c82df824644f9c5070a94dbdb117be17f66d54599ab143648ec57ef93dbcc8 1290 | languageName: node 1291 | linkType: hard 1292 | 1293 | "wasm-sjlj@npm:^1.0.6": 1294 | version: 1.0.6 1295 | resolution: "wasm-sjlj@npm:1.0.6" 1296 | checksum: 10c0/e1172736ca02af383e838ce396b6cc7fc8814d7cc313b30b721c513a79140313cebadb094b9e76d13e27cc679cde72df4e660dbdc5033e8cf66cf0bd176024dd 1297 | languageName: node 1298 | linkType: hard 1299 | 1300 | "wrap-ansi@npm:^6.2.0": 1301 | version: 6.2.0 1302 | resolution: "wrap-ansi@npm:6.2.0" 1303 | dependencies: 1304 | ansi-styles: "npm:^4.0.0" 1305 | string-width: "npm:^4.1.0" 1306 | strip-ansi: "npm:^6.0.0" 1307 | checksum: 10c0/baad244e6e33335ea24e86e51868fe6823626e3a3c88d9a6674642afff1d34d9a154c917e74af8d845fd25d170c4ea9cf69a47133c3f3656e1252b3d462d9f6c 1308 | languageName: node 1309 | linkType: hard 1310 | 1311 | "yocto-queue@npm:^1.0.0": 1312 | version: 1.2.1 1313 | resolution: "yocto-queue@npm:1.2.1" 1314 | checksum: 10c0/5762caa3d0b421f4bdb7a1926b2ae2189fc6e4a14469258f183600028eb16db3e9e0306f46e8ebf5a52ff4b81a881f22637afefbef5399d6ad440824e9b27f9f 1315 | languageName: node 1316 | linkType: hard 1317 | 1318 | "yoctocolors-cjs@npm:^2.1.2": 1319 | version: 2.1.2 1320 | resolution: "yoctocolors-cjs@npm:2.1.2" 1321 | checksum: 10c0/a0e36eb88fea2c7981eab22d1ba45e15d8d268626e6c4143305e2c1628fa17ebfaa40cd306161a8ce04c0a60ee0262058eab12567493d5eb1409780853454c6f 1322 | languageName: node 1323 | linkType: hard 1324 | -------------------------------------------------------------------------------- /libmimalloc-sys/.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | **/*.rs.bk 3 | Cargo.lock -------------------------------------------------------------------------------- /libmimalloc-sys/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | All notable changes to this project will be documented in this file. 4 | 5 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), 6 | and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). 7 | 8 | ## [Unreleased] 9 | 10 | ## [0.1.50](https://github.com/napi-rs/mimalloc-safe/compare/libmimalloc-sys2-v0.1.49...libmimalloc-sys2-v0.1.50) - 2025-07-10 11 | 12 | ### Features 13 | 14 | - *(sys)* upgrade mimalloc to v2.2.4 ([#24](https://github.com/napi-rs/mimalloc-safe/pull/24)) 15 | 16 | ## [0.1.49](https://github.com/napi-rs/mimalloc-safe/compare/libmimalloc-sys2-v0.1.48...libmimalloc-sys2-v0.1.49) - 2025-06-16 17 | 18 | ### Bug Fixes 19 | 20 | - add MI_NO_OPT_ARCH OFF when no_opt_arch is on ([#22](https://github.com/napi-rs/mimalloc-safe/pull/22)) 21 | -------------------------------------------------------------------------------- /libmimalloc-sys/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "libmimalloc-sys2" 3 | version = "0.1.50" 4 | authors = ["Octavian Oncescu ", "Long Yinan "] 5 | edition = "2018" 6 | repository = "https://github.com/napi-rs/mimalloc-safe/tree/master/libmimalloc-sys" 7 | keywords = ["allocator", "encrypted-heap", "performance"] 8 | categories = ["memory-management", "api-bindings"] 9 | description = "Sys crate wrapping the mimalloc allocator" 10 | license = "MIT" 11 | links = "mimalloc_sys2" 12 | exclude = [ 13 | "/c_src/mimalloc/bin", 14 | "/c_src/mimalloc/doc", 15 | "/c_src/mimalloc/docs", 16 | "/c_src/mimalloc/ide", 17 | "/c_src/mimalloc/test", 18 | ] 19 | 20 | [dependencies] 21 | cty = { version = "0.2", optional = true } 22 | libc = "0.2" 23 | 24 | [build-dependencies] 25 | cc = "1.0" 26 | cmake = "0.1" 27 | 28 | [features] 29 | # For debug purposes 30 | etw = [] 31 | asm = [] 32 | secure = [] 33 | override = [] 34 | extended = ["cty"] 35 | arena = [] 36 | local_dynamic_tls = [] 37 | no_thp = [] 38 | skip_collect_on_exit = [] 39 | # turn off `MI_OPT_ARCH`, default is `ON` 40 | no_opt_arch = [] 41 | 42 | # Show `extended` on docs.rs since it's the full API surface. 43 | [package.metadata.docs.rs] 44 | features = ["extended"] 45 | -------------------------------------------------------------------------------- /libmimalloc-sys/LICENSE.txt: -------------------------------------------------------------------------------- 1 | ../LICENSE.txt -------------------------------------------------------------------------------- /libmimalloc-sys/build.rs: -------------------------------------------------------------------------------- 1 | use std::borrow::Cow; 2 | use std::env; 3 | 4 | use cmake::Config; 5 | 6 | fn main() { 7 | let mut cmake_config = Config::new("c_src/mimalloc"); 8 | 9 | let mut mimalloc_base_name = Cow::Borrowed("mimalloc"); 10 | 11 | cmake_config 12 | .define("MI_BUILD_STATIC", "ON") 13 | .define("MI_BUILD_OBJECT", "OFF") 14 | .define("MI_BUILD_SHARED", "OFF") 15 | .define("MI_BUILD_TESTS", "OFF"); 16 | 17 | let target_os = env::var("CARGO_CFG_TARGET_OS").expect("target_os not defined!"); 18 | let target_arch = env::var("CARGO_CFG_TARGET_ARCH").expect("target_arch not defined!"); 19 | let target_env = env::var("CARGO_CFG_TARGET_ENV").expect("target_env not defined!"); 20 | let profile = env::var("PROFILE").expect("profile not defined!"); 21 | 22 | if target_os == "windows" && target_env == "msvc" { 23 | build_mimalloc_win(); 24 | return; 25 | } 26 | 27 | if env::var_os("CARGO_FEATURE_OVERRIDE").is_some() { 28 | cmake_config.define("MI_OVERRIDE", "ON"); 29 | } else { 30 | cmake_config.define("MI_OVERRIDE", "OFF"); 31 | } 32 | 33 | if env::var_os("CARGO_FEATURE_ASM").is_some() { 34 | cmake_config.define("MI_SEE_ASM", "ON"); 35 | } 36 | 37 | if env::var_os("CARGO_FEATURE_SKIP_COLLECT_ON_EXIT").is_some() { 38 | cmake_config.define("MI_SKIP_COLLECT_ON_EXIT", "ON"); 39 | } 40 | 41 | if env::var_os("CARGO_FEATURE_SECURE").is_some() { 42 | cmake_config.define("MI_SECURE", "ON"); 43 | mimalloc_base_name = Cow::Owned(format!("{mimalloc_base_name}-secure")); 44 | } 45 | 46 | if env::var_os("CARGO_FEATURE_ETW").is_some() { 47 | cmake_config.define("MI_TRACK_ETW", "ON"); 48 | } 49 | 50 | if env::var_os("CARGO_FEATURE_NO_OPT_ARCH").is_some() { 51 | cmake_config 52 | .define("MI_OPT_ARCH", "OFF") 53 | .define("MI_NO_OPT_ARCH", "ON"); 54 | } 55 | 56 | if profile == "debug" { 57 | cmake_config 58 | .define("MI_DEBUG_FULL", "ON") 59 | .define("MI_SHOW_ERRORS", "ON"); 60 | mimalloc_base_name = Cow::Owned(format!("{mimalloc_base_name}-debug")); 61 | } 62 | 63 | if target_env == "musl" { 64 | cmake_config 65 | .define("MI_LIBC_MUSL", "ON") 66 | .cflag("-Wno-error=date-time"); 67 | if target_arch == "aarch64" { 68 | cmake_config 69 | .define("MI_OPT_ARCH", "OFF") 70 | .define("MI_NO_OPT_ARCH", "ON"); 71 | } 72 | } 73 | 74 | let dynamic_tls = env::var("CARGO_FEATURE_LOCAL_DYNAMIC_TLS").is_ok(); 75 | 76 | if dynamic_tls { 77 | cmake_config.define("MI_LOCAL_DYNAMIC_TLS", "ON"); 78 | } 79 | 80 | if (target_os == "linux" || target_os == "android") 81 | && env::var_os("CARGO_FEATURE_NO_THP").is_some() 82 | { 83 | cmake_config.define("MI_NO_THP", "1"); 84 | } 85 | 86 | if env::var_os("CARGO_FEATURE_DEBUG").is_some() 87 | || (env::var_os("CARGO_FEATURE_DEBUG_IN_DEBUG").is_some() && cfg!(debug_assertions)) 88 | { 89 | cmake_config.define("MI_DEBUG_FULL", "ON"); 90 | cmake_config.define("MI_SHOW_ERRORS", "ON"); 91 | } else { 92 | // Remove heavy debug assertions etc 93 | cmake_config.define("MI_DEBUG_FULL", "OFF"); 94 | } 95 | 96 | let dst = cmake_config.build(); 97 | 98 | println!("cargo:rustc-link-search=native={}/build", dst.display()); 99 | 100 | println!("cargo:rustc-link-lib=static={mimalloc_base_name}"); 101 | 102 | // on armv6 we need to link with libatomic 103 | if target_os == "linux" && target_arch == "arm" { 104 | // Embrace the atomic capability library across various platforms. 105 | // For instance, on certain platforms, llvm has relocated the atomic of the arm32 architecture to libclang_rt.builtins.a 106 | // while some use libatomic.a, and others use libatomic_ops.a. 107 | let atomic_name = env::var("DEP_ATOMIC").unwrap_or("atomic".to_owned()); 108 | println!("cargo:rustc-link-lib={atomic_name}"); 109 | } 110 | } 111 | 112 | fn build_mimalloc_win() { 113 | use std::env; 114 | 115 | let features = env::var("CARGO_CFG_TARGET_FEATURE") 116 | .map(|features| { 117 | features 118 | .split(",") 119 | .map(|f| f.to_owned()) 120 | .collect::>() 121 | }) 122 | .unwrap_or_default(); 123 | 124 | let mut build = cc::Build::new(); 125 | let target_arch = env::var("CARGO_CFG_TARGET_ARCH").expect("target_arch not defined!"); 126 | 127 | build 128 | .include("./c_src/mimalloc/include") 129 | .include("./c_src/mimalloc/src") 130 | .file("./c_src/mimalloc/src/static.c") 131 | .define("MI_BUILD_SHARED", "0") 132 | .cpp(false) 133 | .warnings(false) 134 | .flag_if_supported("-w"); 135 | 136 | if env::var_os("CARGO_FEATURE_SECURE").is_some() { 137 | build.define("MI_SECURE", "4"); 138 | } 139 | 140 | if env::var_os("CARGO_FEATURE_ASM").is_some() { 141 | build.flag_if_supported("-save-temps"); 142 | } 143 | 144 | if env::var_os("CARGO_FEATURE_NO_OPT_ARCH").is_none() && target_arch == "arm64" { 145 | build.flag_if_supported("/arch:armv8.1"); 146 | } 147 | 148 | if env::var_os("CARGO_FEATURE_SKIP_COLLECT_ON_EXIT").is_some() { 149 | build.define("MI_SKIP_COLLECT_ON_EXIT", "1"); 150 | } 151 | 152 | // Remove heavy debug assertions etc 153 | let profile = std::env::var("PROFILE").unwrap(); 154 | match profile.as_str() { 155 | "debug" => build.define("MI_DEBUG_FULL", "3"), 156 | "release" => build.define("MI_DEBUG_FULL", "0").define("MI_DEBUG", "0"), 157 | _ => build.define("MI_DEBUG_FULL", "3"), 158 | }; 159 | 160 | if build.get_compiler().is_like_msvc() { 161 | build.cpp(true); 162 | } 163 | 164 | const LIBS: [&str; 5] = ["psapi", "shell32", "user32", "advapi32", "bcrypt"]; 165 | 166 | for lib in LIBS { 167 | println!("cargo:rustc-link-lib={lib}"); 168 | } 169 | 170 | if features.contains(&"crt-static".to_string()) { 171 | build.static_crt(true); 172 | } 173 | 174 | build.compile("mimalloc_safe_static"); 175 | } 176 | -------------------------------------------------------------------------------- /libmimalloc-sys/src/extended.rs: -------------------------------------------------------------------------------- 1 | #![allow(nonstandard_style)] 2 | 3 | use core::ffi::c_void; 4 | 5 | use cty::{c_char, c_int, c_long, c_ulonglong}; 6 | 7 | /// The maximum number of bytes which may be used as an argument to a function 8 | /// in the `_small` family ([`mi_malloc_small`], [`mi_zalloc_small`], etc). 9 | pub const MI_SMALL_SIZE_MAX: usize = 128 * core::mem::size_of::<*mut c_void>(); 10 | 11 | extern "C" { 12 | /// Allocate `count` items of `size` length each. 13 | /// 14 | /// Returns `null` if `count * size` overflows or on out-of-memory. 15 | /// 16 | /// All items are initialized to zero. 17 | pub fn mi_calloc(count: usize, size: usize) -> *mut c_void; 18 | 19 | /// Allocate `count` items of `size` length each. 20 | /// 21 | /// Returns `null` if `count * size` overflows or on out-of-memory, 22 | /// otherwise returns the same as [`mi_malloc(count * 23 | /// size)`](crate::mi_malloc). 24 | /// Equivalent to [`mi_calloc`], but returns uninitialized (and not zeroed) 25 | /// bytes. 26 | pub fn mi_mallocn(count: usize, size: usize) -> *mut c_void; 27 | 28 | /// Re-allocate memory to `count` elements of `size` bytes. 29 | /// 30 | /// The realloc equivalent of the [`mi_mallocn`] interface. Returns `null` 31 | /// if `count * size` overflows or on out-of-memory, otherwise returns the 32 | /// same as [`mi_realloc(p, count * size)`](crate::mi_realloc). 33 | pub fn mi_reallocn(p: *mut c_void, count: usize, size: usize) -> *mut c_void; 34 | 35 | /// Try to re-allocate memory to `newsize` bytes _in place_. 36 | /// 37 | /// Returns null on out-of-memory or if the memory could not be expanded in 38 | /// place. On success, returns the same pointer as `p`. 39 | /// 40 | /// If `newsize` is larger than the original `size` allocated for `p`, the 41 | /// bytes after `size` are uninitialized. 42 | /// 43 | /// If null is returned, the original pointer is not freed. 44 | /// 45 | /// Note: Conceptually, this is a realloc-like which returns null if it 46 | /// would be forced to reallocate memory and copy. In practice it's 47 | /// equivalent testing against [`mi_usable_size`](crate::mi_usable_size). 48 | pub fn mi_expand(p: *mut c_void, newsize: usize) -> *mut c_void; 49 | 50 | /// Re-allocate memory to `newsize` bytes. 51 | /// 52 | /// This differs from [`mi_realloc`](crate::mi_realloc) in that on failure, 53 | /// `p` is freed. 54 | pub fn mi_reallocf(p: *mut c_void, newsize: usize) -> *mut c_void; 55 | 56 | /// Allocate and duplicate a nul-terminated C string. 57 | /// 58 | /// This can be useful for Rust code when interacting with the FFI. 59 | pub fn mi_strdup(s: *const c_char) -> *mut c_char; 60 | 61 | /// Allocate and duplicate a nul-terminated C string, up to `n` bytes. 62 | /// 63 | /// This can be useful for Rust code when interacting with the FFI. 64 | pub fn mi_strndup(s: *const c_char, n: usize) -> *mut c_char; 65 | 66 | /// Resolve a file path name, producing a `C` string which can be passed to 67 | /// [`mi_free`](crate::mi_free). 68 | /// 69 | /// `resolved_name` should be null, but can also point to a buffer of at 70 | /// least `PATH_MAX` bytes. 71 | /// 72 | /// If successful, returns a pointer to the resolved absolute file name, or 73 | /// `null` on failure (with `errno` set to the error code). 74 | /// 75 | /// If `resolved_name` was `null`, the returned result should be freed with 76 | /// [`mi_free`](crate::mi_free). 77 | /// 78 | /// This can rarely be useful in FFI code, but is mostly included for 79 | /// completeness. 80 | pub fn mi_realpath(fname: *const c_char, resolved_name: *mut c_char) -> *mut c_char; 81 | 82 | /// Allocate `size * count` bytes aligned by `alignment`. 83 | /// 84 | /// Return pointer to the allocated memory or null if out of memory or if 85 | /// `size * count` overflows. 86 | /// 87 | /// Returns a unique pointer if called with `size * count` 0. 88 | pub fn mi_calloc_aligned(count: usize, size: usize, alignment: usize) -> *mut c_void; 89 | 90 | /// Allocate `size` bytes aligned by `alignment` at a specified `offset`. 91 | /// 92 | /// Note that the resulting pointer itself is not aligned by the alignment, 93 | /// but after `offset` bytes it will be. This can be useful for allocating 94 | /// data with an inline header, where the data has a specific alignment 95 | /// requirement. 96 | /// 97 | /// Specifically, if `p` is the returned pointer `p.add(offset)` is aligned 98 | /// to `alignment`. 99 | pub fn mi_malloc_aligned_at(size: usize, alignment: usize, offset: usize) -> *mut c_void; 100 | 101 | /// Allocate `size` bytes aligned by `alignment` at a specified `offset`, 102 | /// zero-initialized. 103 | /// 104 | /// This is a [`mi_zalloc`](crate::mi_zalloc) equivalent of [`mi_malloc_aligned_at`]. 105 | pub fn mi_zalloc_aligned_at(size: usize, alignment: usize, offset: usize) -> *mut c_void; 106 | 107 | /// Allocate `size` of bytes aligned by `alignment` and place the address of the 108 | /// allocated memory to `ptr`. 109 | /// 110 | /// Returns zero on success, invalid argument for invalid alignment, or out-of-memory. 111 | pub fn mi_posix_memalign(ptr: *mut *mut c_void, alignment: usize, size: usize) -> c_int; 112 | 113 | /// Allocate `size` bytes aligned by `alignment` with alignment as the first 114 | /// parameter. 115 | /// 116 | /// Return pointer to the allocated memory or null if out of memory. 117 | pub fn mi_aligned_alloc(alignment: usize, size: usize) -> *mut c_void; 118 | 119 | /// Allocate `size * count` bytes aligned by `alignment` at a specified 120 | /// `offset`, zero-initialized. 121 | /// 122 | /// This is a [`calloc`](crate::mi_calloc) equivalent of [`mi_malloc_aligned_at`]. 123 | pub fn mi_calloc_aligned_at( 124 | count: usize, 125 | size: usize, 126 | alignment: usize, 127 | offset: usize, 128 | ) -> *mut c_void; 129 | 130 | /// Re-allocate memory to `newsize` bytes aligned by `alignment` at a 131 | /// specified `offset`. 132 | /// 133 | /// This is a [`realloc`](crate::mi_realloc) equivalent of [`mi_malloc_aligned_at`]. 134 | pub fn mi_realloc_aligned_at( 135 | p: *mut c_void, 136 | newsize: usize, 137 | alignment: usize, 138 | offset: usize, 139 | ) -> *mut c_void; 140 | 141 | /// Zero initialized [re-allocation](crate::mi_realloc). 142 | /// 143 | /// In general, only valid on memory originally allocated by zero 144 | /// initialization: [`mi_calloc`](crate::mi_calloc), 145 | /// [`mi_zalloc`](crate::mi_zalloc), 146 | /// [`mi_zalloc_aligned`](crate::mi_zalloc_aligned), ... 147 | pub fn mi_rezalloc(p: *mut c_void, newsize: usize) -> *mut c_void; 148 | 149 | /// Zero initialized [re-allocation](crate::mi_realloc), following `calloc` 150 | /// paramater conventions. 151 | /// 152 | /// In general, only valid on memory originally allocated by zero 153 | /// initialization: [`mi_calloc`](crate::mi_calloc), 154 | /// [`mi_zalloc`](crate::mi_zalloc), 155 | /// [`mi_zalloc_aligned`](crate::mi_zalloc_aligned), ... 156 | pub fn mi_recalloc(p: *mut c_void, newcount: usize, size: usize) -> *mut c_void; 157 | 158 | /// Aligned version of [`mi_rezalloc`]. 159 | pub fn mi_rezalloc_aligned(p: *mut c_void, newsize: usize, alignment: usize) -> *mut c_void; 160 | 161 | /// Offset-aligned version of [`mi_rezalloc`]. 162 | pub fn mi_rezalloc_aligned_at( 163 | p: *mut c_void, 164 | newsize: usize, 165 | alignment: usize, 166 | offset: usize, 167 | ) -> *mut c_void; 168 | 169 | /// Aligned version of [`mi_recalloc`]. 170 | pub fn mi_recalloc_aligned( 171 | p: *mut c_void, 172 | newcount: usize, 173 | size: usize, 174 | alignment: usize, 175 | ) -> *mut c_void; 176 | 177 | /// Offset-aligned version of [`mi_recalloc`]. 178 | pub fn mi_recalloc_aligned_at( 179 | p: *mut c_void, 180 | newcount: usize, 181 | size: usize, 182 | alignment: usize, 183 | offset: usize, 184 | ) -> *mut c_void; 185 | 186 | /// Allocate an object of no more than [`MI_SMALL_SIZE_MAX`] bytes. 187 | /// 188 | /// Does not check that `size` is indeed small. 189 | /// 190 | /// Note: Currently [`mi_malloc`](crate::mi_malloc) checks if `size` is 191 | /// small and calls this if 192 | /// so at runtime, so its' only worth using if you know for certain. 193 | pub fn mi_malloc_small(size: usize) -> *mut c_void; 194 | 195 | /// Allocate an zero-initialized object of no more than 196 | /// [`MI_SMALL_SIZE_MAX`] bytes. 197 | /// 198 | /// Does not check that `size` is indeed small. 199 | /// 200 | /// Note: Currently [`mi_zalloc`](crate::mi_zalloc) checks if `size` is 201 | /// small and calls this if so at runtime, so its' only worth using if you 202 | /// know for certain. 203 | pub fn mi_zalloc_small(size: usize) -> *mut c_void; 204 | 205 | /// Return the available bytes in a memory block. 206 | /// 207 | /// The returned size can be used to call `mi_expand` successfully. 208 | pub fn mi_usable_size(p: *const c_void) -> usize; 209 | 210 | /// Return the used allocation size. 211 | /// 212 | /// Returns the size `n` that will be allocated, where `n >= size`. 213 | /// 214 | /// Generally, `mi_usable_size(mi_malloc(size)) == mi_good_size(size)`. This 215 | /// can be used to reduce internal wasted space when allocating buffers for 216 | /// example. 217 | /// 218 | /// See [`mi_usable_size`](crate::mi_usable_size). 219 | pub fn mi_good_size(size: usize) -> usize; 220 | 221 | /// Eagerly free memory. 222 | /// 223 | /// If `force` is true, aggressively return memory to the OS (can be 224 | /// expensive!) 225 | /// 226 | /// Regular code should not have to call this function. It can be beneficial 227 | /// in very narrow circumstances; in particular, when a long running thread 228 | /// allocates a lot of blocks that are freed by other threads it may improve 229 | /// resource usage by calling this every once in a while. 230 | pub fn mi_collect(force: bool); 231 | 232 | /// Checked free: If `p` came from mimalloc's heap (as decided by 233 | /// [`mi_is_in_heap_region`]), this is [`mi_free(p)`](crate::mi_free), but 234 | /// otherwise it is a no-op. 235 | pub fn mi_cfree(p: *mut c_void); 236 | 237 | /// Returns true if this is a pointer into a memory region that has been 238 | /// reserved by the mimalloc heap. 239 | /// 240 | /// This function is described by the mimalloc documentation as "relatively 241 | /// fast". 242 | /// 243 | /// See also [`mi_heap_check_owned`], which is (much) slower and slightly 244 | /// more precise, but only concerns a single `mi_heap`. 245 | pub fn mi_is_in_heap_region(p: *const c_void) -> bool; 246 | 247 | /// Layout-aware deallocation: Like [`mi_free`](crate::mi_free), but accepts 248 | /// the size and alignment as well. 249 | /// 250 | /// Note: unlike some allocators that require this information for 251 | /// performance, mimalloc doesn't need it (as of the current version, 252 | /// v2.0.0), and so it currently implements this as a (debug) assertion that 253 | /// verifies that `p` is actually aligned to `alignment` and is usable for 254 | /// at least `size` bytes, before delegating to `mi_free`. 255 | /// 256 | /// However, currently there's no way to have this crate enable mimalloc's 257 | /// debug assertions, so these checks aren't particularly useful. 258 | /// 259 | /// Note: It's legal to pass null to this function, and you are not required 260 | /// to use this to deallocate memory from an aligned allocation function. 261 | pub fn mi_free_size_aligned(p: *mut c_void, size: usize, alignment: usize); 262 | 263 | /// Size-aware deallocation: Like [`mi_free`](crate::mi_free), but accepts 264 | /// the size and alignment as well. 265 | /// 266 | /// Note: unlike some allocators that require this information for 267 | /// performance, mimalloc doesn't need it (as of the current version, 268 | /// v2.0.0), and so it currently implements this as a (debug) assertion that 269 | /// verifies that `p` is actually aligned to `alignment` and is usable for 270 | /// at least `size` bytes, before delegating to `mi_free`. 271 | /// 272 | /// However, currently there's no way to have this crate enable mimalloc's 273 | /// debug assertions, so these checks aren't particularly useful. 274 | /// 275 | /// Note: It's legal to pass null to this function. 276 | pub fn mi_free_size(p: *mut c_void, size: usize); 277 | 278 | /// Alignment-aware deallocation: Like [`mi_free`](crate::mi_free), but 279 | /// accepts the size and alignment as well. 280 | /// 281 | /// Note: unlike some allocators that require this information for 282 | /// performance, mimalloc doesn't need it (as of the current version, 283 | /// v2.0.0), and so it currently implements this as a (debug) assertion that 284 | /// verifies that `p` is actually aligned to `alignment` and is usable for 285 | /// at least `size` bytes, before delegating to `mi_free`. 286 | /// 287 | /// However, currently there's no way to have this crate enable mimalloc's 288 | /// debug assertions, so these checks aren't particularly useful. 289 | /// 290 | /// Note: It's legal to pass null to this function. 291 | pub fn mi_free_aligned(p: *mut c_void, alignment: usize); 292 | 293 | /// Print the main statistics. 294 | /// 295 | /// Ignores the passed in argument, and outputs to the registered output 296 | /// function or stderr by default. 297 | /// 298 | /// Most detailed when using a debug build. 299 | pub fn mi_stats_print(_: *mut c_void); 300 | 301 | /// Print the main statistics. 302 | /// 303 | /// Pass `None` for `out` to use the default. If `out` is provided, `arc` is 304 | /// passed as it's second parameter. 305 | /// 306 | /// Most detailed when using a debug build. 307 | pub fn mi_stats_print_out(out: mi_output_fun, arg: *mut c_void); 308 | 309 | /// Reset statistics. 310 | /// 311 | /// Note: This function is thread safe. 312 | pub fn mi_stats_reset(); 313 | 314 | /// Merge thread local statistics with the main statistics and reset. 315 | /// 316 | /// Note: This function is thread safe. 317 | pub fn mi_stats_merge(); 318 | 319 | /// Return the mimalloc version number. 320 | /// 321 | /// For example version 1.6.3 would return the number `163`. 322 | pub fn mi_version() -> c_int; 323 | 324 | /// Initialize mimalloc on a thread. 325 | /// 326 | /// Should not be used as on most systems (pthreads, windows) this is done 327 | /// automatically. 328 | pub fn mi_thread_init(); 329 | 330 | /// Initialize the process. 331 | /// 332 | /// Should not be used on most systems, as it's called by thread_init or the 333 | /// process loader. 334 | pub fn mi_process_init(); 335 | 336 | /// Return process information (time and memory usage). All parameters are 337 | /// optional (nullable) out-params: 338 | /// 339 | /// | Parameter | Description | 340 | /// | :- | :- | 341 | /// | `elapsed_msecs` | Elapsed wall-clock time of the process in milli-seconds. | 342 | /// | `user_msecs` | User time in milli-seconds (as the sum over all threads). | 343 | /// | `system_msecs` | System time in milli-seconds. | 344 | /// | `current_rss` | Current working set size (touched pages). | 345 | /// | `peak_rss` | Peak working set size (touched pages). | 346 | /// | `current_commit` | Current committed memory (backed by the page file). | 347 | /// | `peak_commit` | Peak committed memory (backed by the page file). | 348 | /// | `page_faults` | Count of hard page faults. | 349 | /// 350 | /// The `current_rss` is precise on Windows and MacOSX; other systems 351 | /// estimate this using `current_commit`. The `commit` is precise on Windows 352 | /// but estimated on other systems as the amount of read/write accessible 353 | /// memory reserved by mimalloc. 354 | pub fn mi_process_info( 355 | elapsed_msecs: *mut usize, 356 | user_msecs: *mut usize, 357 | system_msecs: *mut usize, 358 | current_rss: *mut usize, 359 | peak_rss: *mut usize, 360 | current_commit: *mut usize, 361 | peak_commit: *mut usize, 362 | page_faults: *mut usize, 363 | ); 364 | 365 | /// Uninitialize mimalloc on a thread. 366 | /// 367 | /// Should not be used as on most systems (pthreads, windows) this is done 368 | /// automatically. Ensures that any memory that is not freed yet (but will 369 | /// be freed by other threads in the future) is properly handled. 370 | /// 371 | /// Note: This function is thread safe. 372 | pub fn mi_thread_done(); 373 | 374 | /// Print out heap statistics for this thread. 375 | /// 376 | /// Pass `None` for `out` to use the default. If `out` is provided, `arc` is 377 | /// passed as it's second parameter 378 | /// 379 | /// Most detailed when using a debug build. 380 | /// 381 | /// Note: This function is thread safe. 382 | pub fn mi_thread_stats_print_out(out: mi_output_fun, arg: *mut c_void); 383 | 384 | /// Register an output function. 385 | /// 386 | /// - `out` The output function, use `None` to output to stderr. 387 | /// - `arg` Argument that will be passed on to the output function. 388 | /// 389 | /// The `out` function is called to output any information from mimalloc, 390 | /// like verbose or warning messages. 391 | /// 392 | /// Note: This function is thread safe. 393 | pub fn mi_register_output(out: mi_output_fun, arg: *mut c_void); 394 | 395 | /// Register a deferred free function. 396 | /// 397 | /// - `deferred_free` Address of a deferred free-ing function or `None` to 398 | /// unregister. 399 | /// - `arg` Argument that will be passed on to the deferred free function. 400 | /// 401 | /// Some runtime systems use deferred free-ing, for example when using 402 | /// reference counting to limit the worst case free time. 403 | /// 404 | /// Such systems can register (re-entrant) deferred free function to free 405 | /// more memory on demand. 406 | /// 407 | /// - When the `force` parameter is `true` all possible memory should be 408 | /// freed. 409 | /// 410 | /// - The per-thread `heartbeat` parameter is monotonically increasing and 411 | /// guaranteed to be deterministic if the program allocates 412 | /// deterministically. 413 | /// 414 | /// - The `deferred_free` function is guaranteed to be called 415 | /// deterministically after some number of allocations (regardless of 416 | /// freeing or available free memory). 417 | /// 418 | /// At most one `deferred_free` function can be active. 419 | /// 420 | /// Note: This function is thread safe. 421 | pub fn mi_register_deferred_free(out: mi_deferred_free_fun, arg: *mut c_void); 422 | 423 | /// Register an error callback function. 424 | /// 425 | /// The `errfun` function is called on an error in mimalloc after emitting 426 | /// an error message (through the output function). 427 | /// 428 | /// It as always legal to just return from the `errfun` function in which 429 | /// case allocation functions generally return null or ignore the condition. 430 | /// 431 | /// The default function only calls abort() when compiled in secure mode 432 | /// with an `EFAULT` error. The possible error codes are: 433 | /// 434 | /// - `EAGAIN` (11): Double free was detected (only in debug and secure 435 | /// mode). 436 | /// - `EFAULT` (14): Corrupted free list or meta-data was detected (only in 437 | /// debug and secure mode). 438 | /// - `ENOMEM` (12): Not enough memory available to satisfy the request. 439 | /// - `EOVERFLOW` (75): Too large a request, for example in `mi_calloc`, the 440 | /// `count` and `size` parameters are too large. 441 | /// - `EINVAL` (22): Trying to free or re-allocate an invalid pointer. 442 | /// 443 | /// Note: This function is thread safe. 444 | pub fn mi_register_error(out: mi_error_fun, arg: *mut c_void); 445 | } 446 | 447 | /// An output callback. Must be thread-safe. 448 | /// 449 | /// See [`mi_stats_print_out`], [`mi_thread_stats_print_out`], [`mi_register_output`] 450 | pub type mi_output_fun = Option; 451 | 452 | /// Type of deferred free functions. Must be thread-safe. 453 | /// 454 | /// - `force`: If true, all outstanding items should be freed. 455 | /// - `heartbeat` A monotonically increasing count. 456 | /// - `arg` Argument that was passed at registration to hold extra state. 457 | /// 458 | /// See [`mi_register_deferred_free`] 459 | pub type mi_deferred_free_fun = 460 | Option; 461 | 462 | /// Type of error callback functions. Must be thread-safe. 463 | /// 464 | /// - `err`: Error code (see [`mi_register_error`] for a list). 465 | /// - `arg`: Argument that was passed at registration to hold extra state. 466 | /// 467 | /// See [`mi_register_error`] 468 | pub type mi_error_fun = Option; 469 | 470 | /// Runtime options. All options are false by default. 471 | pub type mi_option_t = c_int; 472 | 473 | #[cfg(feature = "arena")] 474 | /// Arena Id 475 | pub type mi_arena_id_t = c_int; 476 | 477 | // Note: mimalloc doc website seems to have the order of show_stats and 478 | // show_errors reversed as of 1.6.3, however what I have here is correct: 479 | // https://github.com/microsoft/mimalloc/issues/266#issuecomment-653822341 480 | 481 | /// Print error messages to `stderr`. 482 | pub const mi_option_show_errors: mi_option_t = 0; 483 | 484 | /// Print statistics to `stderr` when the program is done. 485 | pub const mi_option_show_stats: mi_option_t = 1; 486 | 487 | /// Print verbose messages to `stderr`. 488 | pub const mi_option_verbose: mi_option_t = 2; 489 | 490 | /// ### The following options are experimental 491 | /// 492 | /// Option (experimental) Use large OS pages (2MiB in size) if possible. 493 | /// 494 | /// Use large OS pages (2MiB) when available; for some workloads this can 495 | /// significantly improve performance. Use mi_option_verbose to check if 496 | /// the large OS pages are enabled -- usually one needs to explicitly allow 497 | /// large OS pages (as on Windows and Linux). However, sometimes the OS is 498 | /// very slow to reserve contiguous physical memory for large OS pages so 499 | /// use with care on systems that can have fragmented memory (for that 500 | /// reason, we generally recommend to use mi_option_reserve_huge_os_pages 501 | /// instead whenever possible). 502 | pub const mi_option_large_os_pages: mi_option_t = 6; 503 | 504 | /// Option (experimental) The number of huge OS pages (1GiB in size) to reserve at the start of the program. 505 | /// 506 | /// This reserves the huge pages at startup and sometimes this can give a large (latency) performance 507 | /// improvement on big workloads. Usually it is better to not use MIMALLOC_LARGE_OS_PAGES in 508 | /// combination with this setting. Just like large OS pages, use with care as reserving contiguous 509 | /// physical memory can take a long time when memory is fragmented (but reserving the huge pages is 510 | /// done at startup only once). Note that we usually need to explicitly enable huge OS pages (as on 511 | /// Windows and Linux)). With huge OS pages, it may be beneficial to set the setting 512 | /// mi_option_eager_commit_delay=N (N is 1 by default) to delay the initial N segments (of 4MiB) of 513 | /// a thread to not allocate in the huge OS pages; this prevents threads that are short lived and 514 | /// allocate just a little to take up space in the huge OS page area (which cannot be reset). 515 | pub const mi_option_reserve_huge_os_pages: mi_option_t = 7; 516 | 517 | /// Option (experimental) Reserve huge OS pages at node N. 518 | /// 519 | /// The huge pages are usually allocated evenly among NUMA nodes. 520 | /// You can use mi_option_reserve_huge_os_pages_at=N where `N` is the numa node (starting at 0) to allocate all 521 | /// the huge pages at a specific numa node instead. 522 | pub const mi_option_reserve_huge_os_pages_at: mi_option_t = 8; 523 | 524 | /// Option (experimental) Reserve specified amount of OS memory at startup, e.g. "1g" or "512m". 525 | pub const mi_option_reserve_os_memory: mi_option_t = 9; 526 | 527 | /// Option (experimental) the first N segments per thread are not eagerly committed (=1). 528 | pub const mi_option_eager_commit_delay: mi_option_t = 14; 529 | 530 | /// Option (experimental) Pretend there are at most N NUMA nodes; Use 0 to use the actual detected NUMA nodes at runtime. 531 | pub const mi_option_use_numa_nodes: mi_option_t = 16; 532 | 533 | /// Option (experimental) If set to 1, do not use OS memory for allocation (but only pre-reserved arenas) 534 | pub const mi_option_limit_os_alloc: mi_option_t = 17; 535 | 536 | /// Option (experimental) OS tag to assign to mimalloc'd memory 537 | pub const mi_option_os_tag: mi_option_t = 18; 538 | 539 | /// Option (experimental) 540 | pub const mi_option_max_errors: mi_option_t = 19; 541 | 542 | /// Option (experimental) 543 | pub const mi_option_max_warnings: mi_option_t = 20; 544 | 545 | /// Option (experimental) 546 | pub const mi_option_max_segment_reclaim: mi_option_t = 21; 547 | 548 | /// Option (experimental) 549 | pub const mi_option_destroy_on_exit: mi_option_t = 22; 550 | 551 | /// Option (experimental) 552 | pub const mi_option_arena_reserve: mi_option_t = 23; 553 | 554 | /// Option (experimental) 555 | pub const mi_option_arena_purge_mult: mi_option_t = 24; 556 | 557 | /// Option (experimental) 558 | pub const mi_option_purge_extend_delay: mi_option_t = 25; 559 | 560 | /// Option (experimental) 561 | pub const mi_option_abandoned_reclaim_on_free: mi_option_t = 26; 562 | 563 | /// Option (experimental) 564 | pub const mi_option_disallow_arena_alloc: mi_option_t = 27; 565 | 566 | /// Option (experimental) 567 | pub const mi_option_retry_on_oom: mi_option_t = 28; 568 | 569 | /// Option (experimental) 570 | pub const mi_option_visit_abandoned: mi_option_t = 29; 571 | 572 | /// Option (experimental) 573 | pub const mi_option_guarded_min: mi_option_t = 30; 574 | 575 | /// Option (experimental) 576 | pub const mi_option_guarded_max: mi_option_t = 31; 577 | 578 | /// Option (experimental) 579 | pub const mi_option_guarded_precise: mi_option_t = 32; 580 | 581 | /// Option (experimental) 582 | pub const mi_option_guarded_sample_rate: mi_option_t = 33; 583 | 584 | /// Option (experimental) 585 | pub const mi_option_guarded_sample_seed: mi_option_t = 34; 586 | 587 | /// Option (experimental) 588 | pub const mi_option_target_segments_per_thread: mi_option_t = 35; 589 | 590 | /// Option (experimental) 591 | pub const mi_option_generic_collect: mi_option_t = 36; 592 | 593 | /// Last option. 594 | pub const _mi_option_last: mi_option_t = 37; 595 | 596 | extern "C" { 597 | // Note: mi_option_{enable,disable} aren't exposed because they're redundant 598 | // and because of https://github.com/microsoft/mimalloc/issues/266. 599 | 600 | /// Returns true if the provided option is enabled. 601 | /// 602 | /// Note: this function is not thread safe. 603 | pub fn mi_option_is_enabled(option: mi_option_t) -> bool; 604 | 605 | /// Enable or disable the given option. 606 | /// 607 | /// Note: this function is not thread safe. 608 | pub fn mi_option_set_enabled(option: mi_option_t, enable: bool); 609 | 610 | /// If the given option has not yet been initialized with [`mi_option_set`] 611 | /// or [`mi_option_set_enabled`], enables or disables the option. If it has, 612 | /// this function does nothing. 613 | /// 614 | /// Note: this function is not thread safe. 615 | pub fn mi_option_set_enabled_default(option: mi_option_t, enable: bool); 616 | 617 | /// Returns the value of the provided option. 618 | /// 619 | /// The value of boolean options is 1 or 0, however experimental options 620 | /// exist which take a numeric value, which is the intended use of this 621 | /// function. 622 | /// 623 | /// These options are not exposed as constants for stability reasons, 624 | /// however you can still use them as arguments to this and other 625 | /// `mi_option_` functions if needed, see the mimalloc documentation for 626 | /// details: https://microsoft.github.io/mimalloc/group__options.html 627 | /// 628 | /// Note: this function is not thread safe. 629 | pub fn mi_option_get(option: mi_option_t) -> c_long; 630 | 631 | /// Set the option to the given value. 632 | /// 633 | /// The value of boolean options is 1 or 0, however experimental options 634 | /// exist which take a numeric value, which is the intended use of this 635 | /// function. 636 | /// 637 | /// These options are not exposed as constants for stability reasons, 638 | /// however you can still use them as arguments to this and other 639 | /// `mi_option_` functions if needed, 640 | /// 641 | /// Note: this function is not thread safe. 642 | pub fn mi_option_set(option: mi_option_t, value: c_long); 643 | 644 | /// If the given option has not yet been initialized with [`mi_option_set`] 645 | /// or [`mi_option_set_enabled`], sets the option to the given value. If it 646 | /// has, this function does nothing. 647 | /// 648 | /// The value of boolean options is 1 or 0, however experimental options 649 | /// exist which take a numeric value, which is the intended use of this 650 | /// function. 651 | /// 652 | /// These options are not exposed as constants for stability reasons, 653 | /// however you can still use them as arguments to this and other 654 | /// `mi_option_` functions if needed. 655 | /// 656 | /// Note: this function is not thread safe. 657 | pub fn mi_option_set_default(option: mi_option_t, value: c_long); 658 | } 659 | 660 | /// First-class heaps that can be destroyed in one go. 661 | /// 662 | /// Note: The pointers allocated out of a heap can be be freed using 663 | /// [`mi_free`](crate::mi_free) -- there is no `mi_heap_free`. 664 | /// 665 | /// # Example 666 | /// 667 | /// ``` 668 | /// use libmimalloc_sys as mi; 669 | /// unsafe { 670 | /// let h = mi::mi_heap_new(); 671 | /// assert!(!h.is_null()); 672 | /// let p = mi::mi_heap_malloc(h, 50); 673 | /// assert!(!p.is_null()); 674 | /// 675 | /// // use p... 676 | /// mi::mi_free(p); 677 | /// 678 | /// // Clean up the heap. Note that pointers allocated from `h` 679 | /// // are *not* invalided by `mi_heap_delete`. You would have 680 | /// // to use (the very dangerous) `mi_heap_destroy` for that 681 | /// // behavior 682 | /// mi::mi_heap_delete(h); 683 | /// } 684 | /// ``` 685 | pub enum mi_heap_t {} 686 | 687 | /// An area of heap space contains blocks of a single size. 688 | /// 689 | /// The bytes in freed blocks are `committed - used`. 690 | #[repr(C)] 691 | #[derive(Debug, Clone, Copy)] 692 | pub struct mi_heap_area_t { 693 | /// Start of the area containing heap blocks. 694 | pub blocks: *mut c_void, 695 | /// Bytes reserved for this area. 696 | pub reserved: usize, 697 | /// Current committed bytes of this area. 698 | pub committed: usize, 699 | /// Bytes in use by allocated blocks. 700 | pub used: usize, 701 | /// Size in bytes of one block. 702 | pub block_size: usize, 703 | /// Size in bytes of a full block including padding and metadata. 704 | pub full_block_size: usize, 705 | /// Heap tag associated with this area (see \a mi_heap_new_ex) 706 | pub heap_tag: c_int, 707 | } 708 | 709 | /// Visitor function passed to [`mi_heap_visit_blocks`] 710 | /// 711 | /// Should return `true` to continue, and `false` to stop visiting (i.e. break) 712 | /// 713 | /// This function is always first called for every `area` with `block` as a null 714 | /// pointer. If `visit_all_blocks` was `true`, the function is then called for 715 | /// every allocated block in that area. 716 | pub type mi_block_visit_fun = Option< 717 | unsafe extern "C" fn( 718 | heap: *const mi_heap_t, 719 | area: *const mi_heap_area_t, 720 | block: *mut c_void, 721 | block_size: usize, 722 | arg: *mut c_void, 723 | ) -> bool, 724 | >; 725 | 726 | extern "C" { 727 | /// Create a new heap that can be used for allocation. 728 | pub fn mi_heap_new() -> *mut mi_heap_t; 729 | 730 | /// Delete a previously allocated heap. 731 | /// 732 | /// This will release resources and migrate any still allocated blocks in 733 | /// this heap (efficienty) to the default heap. 734 | /// 735 | /// If `heap` is the default heap, the default heap is set to the backing 736 | /// heap. 737 | pub fn mi_heap_delete(heap: *mut mi_heap_t); 738 | 739 | /// Destroy a heap, freeing all its still allocated blocks. 740 | /// 741 | /// Use with care as this will free all blocks still allocated in the heap. 742 | /// However, this can be a very efficient way to free all heap memory in one 743 | /// go. 744 | /// 745 | /// If `heap` is the default heap, the default heap is set to the backing 746 | /// heap. 747 | pub fn mi_heap_destroy(heap: *mut mi_heap_t); 748 | 749 | /// Set the default heap to use for [`mi_malloc`](crate::mi_malloc) et al. 750 | /// 751 | /// Returns the previous default heap. 752 | pub fn mi_heap_set_default(heap: *mut mi_heap_t) -> *mut mi_heap_t; 753 | 754 | /// Get the default heap that is used for [`mi_malloc`](crate::mi_malloc) et al. 755 | pub fn mi_heap_get_default() -> *mut mi_heap_t; 756 | 757 | /// Get the backing heap. 758 | /// 759 | /// The _backing_ heap is the initial default heap for a thread and always 760 | /// available for allocations. It cannot be destroyed or deleted except by 761 | /// exiting the thread. 762 | pub fn mi_heap_get_backing() -> *mut mi_heap_t; 763 | 764 | /// Release outstanding resources in a specific heap. 765 | /// 766 | /// See also [`mi_collect`]. 767 | pub fn mi_heap_collect(heap: *mut mi_heap_t, force: bool); 768 | 769 | /// Equivalent to [`mi_malloc`](crate::mi_malloc), but allocates out of the 770 | /// specific heap instead of the default. 771 | pub fn mi_heap_malloc(heap: *mut mi_heap_t, size: usize) -> *mut c_void; 772 | 773 | /// Equivalent to [`mi_zalloc`](crate::mi_zalloc), but allocates out of the 774 | /// specific heap instead of the default. 775 | pub fn mi_heap_zalloc(heap: *mut mi_heap_t, size: usize) -> *mut c_void; 776 | 777 | /// Equivalent to [`mi_calloc`], but allocates out of the specific heap 778 | /// instead of the default. 779 | pub fn mi_heap_calloc(heap: *mut mi_heap_t, count: usize, size: usize) -> *mut c_void; 780 | 781 | /// Equivalent to [`mi_mallocn`], but allocates out of the specific heap 782 | /// instead of the default. 783 | pub fn mi_heap_mallocn(heap: *mut mi_heap_t, count: usize, size: usize) -> *mut c_void; 784 | 785 | /// Equivalent to [`mi_malloc_small`], but allocates out of the specific 786 | /// heap instead of the default. 787 | /// 788 | /// `size` must be smaller or equal to [`MI_SMALL_SIZE_MAX`]. 789 | pub fn mi_heap_malloc_small(heap: *mut mi_heap_t, size: usize) -> *mut c_void; 790 | 791 | /// Equivalent to [`mi_realloc`](crate::mi_realloc), but allocates out of 792 | /// the specific heap instead of the default. 793 | pub fn mi_heap_realloc(heap: *mut mi_heap_t, p: *mut c_void, newsize: usize) -> *mut c_void; 794 | 795 | /// Equivalent to [`mi_reallocn`], but allocates out of the specific heap 796 | /// instead of the default. 797 | pub fn mi_heap_reallocn( 798 | heap: *mut mi_heap_t, 799 | p: *mut c_void, 800 | count: usize, 801 | size: usize, 802 | ) -> *mut c_void; 803 | 804 | /// Equivalent to [`mi_reallocf`], but allocates out of the specific heap 805 | /// instead of the default. 806 | pub fn mi_heap_reallocf(heap: *mut mi_heap_t, p: *mut c_void, newsize: usize) -> *mut c_void; 807 | 808 | /// Equivalent to [`mi_strdup`], but allocates out of the specific heap 809 | /// instead of the default. 810 | pub fn mi_heap_strdup(heap: *mut mi_heap_t, s: *const c_char) -> *mut c_char; 811 | 812 | /// Equivalent to [`mi_strndup`], but allocates out of the specific heap 813 | /// instead of the default. 814 | pub fn mi_heap_strndup(heap: *mut mi_heap_t, s: *const c_char, n: usize) -> *mut c_char; 815 | 816 | /// Equivalent to [`mi_realpath`], but allocates out of the specific heap 817 | /// instead of the default. 818 | pub fn mi_heap_realpath( 819 | heap: *mut mi_heap_t, 820 | fname: *const c_char, 821 | resolved_name: *mut c_char, 822 | ) -> *mut c_char; 823 | 824 | /// Equivalent to [`mi_malloc_aligned`](crate::mi_malloc_aligned), but 825 | /// allocates out of the specific heap instead of the default. 826 | pub fn mi_heap_malloc_aligned( 827 | heap: *mut mi_heap_t, 828 | size: usize, 829 | alignment: usize, 830 | ) -> *mut c_void; 831 | 832 | /// Equivalent to [`mi_malloc_aligned_at`], but allocates out of the 833 | /// specific heap instead of the default. 834 | pub fn mi_heap_malloc_aligned_at( 835 | heap: *mut mi_heap_t, 836 | size: usize, 837 | alignment: usize, 838 | offset: usize, 839 | ) -> *mut c_void; 840 | 841 | /// Equivalent to [`mi_zalloc_aligned`](crate::mi_zalloc_aligned), but 842 | /// allocates out of the specific heap instead of the default. 843 | pub fn mi_heap_zalloc_aligned( 844 | heap: *mut mi_heap_t, 845 | size: usize, 846 | alignment: usize, 847 | ) -> *mut c_void; 848 | 849 | /// Equivalent to [`mi_zalloc_aligned_at`], but allocates out of the 850 | /// specific heap instead of the default. 851 | pub fn mi_heap_zalloc_aligned_at( 852 | heap: *mut mi_heap_t, 853 | size: usize, 854 | alignment: usize, 855 | offset: usize, 856 | ) -> *mut c_void; 857 | 858 | /// Equivalent to [`mi_calloc_aligned`], but allocates out of the specific 859 | /// heap instead of the default. 860 | pub fn mi_heap_calloc_aligned( 861 | heap: *mut mi_heap_t, 862 | count: usize, 863 | size: usize, 864 | alignment: usize, 865 | ) -> *mut c_void; 866 | 867 | /// Equivalent to [`mi_calloc_aligned_at`], but allocates out of the 868 | /// specific heap instead of the default. 869 | pub fn mi_heap_calloc_aligned_at( 870 | heap: *mut mi_heap_t, 871 | count: usize, 872 | size: usize, 873 | alignment: usize, 874 | offset: usize, 875 | ) -> *mut c_void; 876 | 877 | /// Equivalent to [`mi_realloc_aligned`](crate::mi_realloc_aligned), but allocates out of the specific 878 | /// heap instead of the default. 879 | pub fn mi_heap_realloc_aligned( 880 | heap: *mut mi_heap_t, 881 | p: *mut c_void, 882 | newsize: usize, 883 | alignment: usize, 884 | ) -> *mut c_void; 885 | 886 | /// Equivalent to [`mi_realloc_aligned_at`], but allocates out of the 887 | /// specific heap instead of the default. 888 | pub fn mi_heap_realloc_aligned_at( 889 | heap: *mut mi_heap_t, 890 | p: *mut c_void, 891 | newsize: usize, 892 | alignment: usize, 893 | offset: usize, 894 | ) -> *mut c_void; 895 | 896 | /// Equivalent to [`mi_rezalloc`], but allocates out of the specific heap 897 | /// instead of the default. 898 | pub fn mi_heap_rezalloc(heap: *mut mi_heap_t, p: *mut c_void, newsize: usize) -> *mut c_void; 899 | 900 | /// Equivalent to [`mi_recalloc`], but allocates out of the specific heap 901 | /// instead of the default. 902 | pub fn mi_heap_recalloc( 903 | heap: *mut mi_heap_t, 904 | p: *mut c_void, 905 | newcount: usize, 906 | size: usize, 907 | ) -> *mut c_void; 908 | 909 | /// Equivalent to [`mi_rezalloc_aligned`], but allocates out of the specific 910 | /// heap instead of the default. 911 | pub fn mi_heap_rezalloc_aligned( 912 | heap: *mut mi_heap_t, 913 | p: *mut c_void, 914 | newsize: usize, 915 | alignment: usize, 916 | ) -> *mut c_void; 917 | 918 | /// Equivalent to [`mi_rezalloc_aligned_at`], but allocates out of the 919 | /// specific heap instead of the default. 920 | pub fn mi_heap_rezalloc_aligned_at( 921 | heap: *mut mi_heap_t, 922 | p: *mut c_void, 923 | newsize: usize, 924 | alignment: usize, 925 | offset: usize, 926 | ) -> *mut c_void; 927 | 928 | /// Equivalent to [`mi_recalloc_aligned`], but allocates out of the 929 | /// specific heap instead of the default. 930 | pub fn mi_heap_recalloc_aligned( 931 | heap: *mut mi_heap_t, 932 | p: *mut c_void, 933 | newcount: usize, 934 | size: usize, 935 | alignment: usize, 936 | ) -> *mut c_void; 937 | 938 | /// Equivalent to [`mi_recalloc_aligned_at`], but allocates out of the 939 | /// specific heap instead of the default. 940 | pub fn mi_heap_recalloc_aligned_at( 941 | heap: *mut mi_heap_t, 942 | p: *mut c_void, 943 | newcount: usize, 944 | size: usize, 945 | alignment: usize, 946 | offset: usize, 947 | ) -> *mut c_void; 948 | 949 | /// Does a heap contain a pointer to a previously allocated block? 950 | /// 951 | /// `p` must be a pointer to a previously allocated block (in any heap) -- it cannot be some 952 | /// random pointer! 953 | /// 954 | /// Returns `true` if the block pointed to by `p` is in the `heap`. 955 | /// 956 | /// See [`mi_heap_check_owned`]. 957 | pub fn mi_heap_contains_block(heap: *mut mi_heap_t, p: *const c_void) -> bool; 958 | 959 | /// Check safely if any pointer is part of a heap. 960 | /// 961 | /// `p` may be any pointer -- not required to be previously allocated by the 962 | /// given heap or any other mimalloc heap. Returns `true` if `p` points to a 963 | /// block in the given heap, false otherwise. 964 | /// 965 | /// Note: expensive function, linear in the pages in the heap. 966 | /// 967 | /// See [`mi_heap_contains_block`], [`mi_heap_get_default`], and 968 | /// [`mi_is_in_heap_region`] 969 | pub fn mi_heap_check_owned(heap: *mut mi_heap_t, p: *const c_void) -> bool; 970 | 971 | /// Check safely if any pointer is part of the default heap of this thread. 972 | /// 973 | /// `p` may be any pointer -- not required to be previously allocated by the 974 | /// default heap for this thread, or any other mimalloc heap. Returns `true` 975 | /// if `p` points to a block in the default heap, false otherwise. 976 | /// 977 | /// Note: expensive function, linear in the pages in the heap. 978 | /// 979 | /// See [`mi_heap_contains_block`], [`mi_heap_get_default`] 980 | pub fn mi_check_owned(p: *const c_void) -> bool; 981 | 982 | /// Visit all areas and blocks in `heap`. 983 | /// 984 | /// If `visit_all_blocks` is false, the `visitor` is only called once for 985 | /// every heap area. If it's true, the `visitor` is also called for every 986 | /// allocated block inside every area (with `!block.is_null()`). Return 987 | /// `false` from the `visitor` to return early. 988 | /// 989 | /// `arg` is an extra argument passed into the `visitor`. 990 | /// 991 | /// Returns `true` if all areas and blocks were visited. 992 | /// 993 | /// Passing a `None` visitor is allowed, and is a no-op. 994 | pub fn mi_heap_visit_blocks( 995 | heap: *const mi_heap_t, 996 | visit_all_blocks: bool, 997 | visitor: mi_block_visit_fun, 998 | arg: *mut c_void, 999 | ) -> bool; 1000 | 1001 | #[cfg(feature = "arena")] 1002 | /// Create a heap that only allocates in the specified arena 1003 | pub fn mi_heap_new_in_arena(arena_id: mi_arena_id_t) -> *mut mi_heap_t; 1004 | 1005 | #[cfg(feature = "arena")] 1006 | /// Reserve OS memory for use by mimalloc. Reserved areas are used 1007 | /// before allocating from the OS again. By reserving a large area upfront, 1008 | /// allocation can be more efficient, and can be better managed on systems 1009 | /// without `mmap`/`VirtualAlloc` (like WASM for example). 1010 | /// 1011 | /// - `size` The size to reserve. 1012 | /// - `commit` Commit the memory upfront. 1013 | /// - `allow_large` Allow large OS pages (2MiB) to be used? 1014 | /// - `exclusive` Only allow allocations if specifically for this arena. 1015 | /// - `arena_id` Pointer who's value will be set to the new arena_id if successful. 1016 | /// 1017 | /// Returns 0 if successful, and an error code otherwise (e.g. `ENOMEM`) 1018 | pub fn mi_reserve_os_memory_ex( 1019 | size: usize, 1020 | commit: bool, 1021 | allow_large: bool, 1022 | exclusive: bool, 1023 | arena_id: *mut mi_arena_id_t, 1024 | ) -> c_int; 1025 | 1026 | #[cfg(feature = "arena")] 1027 | /// Manage a particular memory area for use by mimalloc. 1028 | /// This is just like `mi_reserve_os_memory_ex` except that the area should already be 1029 | /// allocated in some manner and available for use my mimalloc. 1030 | /// 1031 | /// # Safety 1032 | /// mimalloc will likely segfault when allocating from the arena if the arena `start` & `size` 1033 | /// aren't aligned with mimalloc's `MI_SEGMENT_ALIGN` (e.g. 32MB on x86_64 machines). 1034 | /// 1035 | /// - `start` Start of the memory area 1036 | /// - `size` The size of the memory area. Must be large than `MI_ARENA_BLOCK_SIZE` (e.g. 64MB 1037 | /// on x86_64 machines). 1038 | /// - `commit` Set true if the memory range is already commited. 1039 | /// - `is_large` Set true if the memory range consists of large files, or if the memory should 1040 | /// not be decommitted or protected (like rdma etc.). 1041 | /// - `is_zero` Set true if the memory range consists only of zeros. 1042 | /// - `numa_node` Possible associated numa node or `-1`. 1043 | /// - `exclusive` Only allow allocations if specifically for this arena. 1044 | /// - `arena_id` Pointer who's value will be set to the new arena_id if successful. 1045 | /// 1046 | /// Returns `true` if arena was successfully allocated 1047 | pub fn mi_manage_os_memory_ex( 1048 | start: *const c_void, 1049 | size: usize, 1050 | is_committed: bool, 1051 | is_large: bool, 1052 | is_zero: bool, 1053 | numa_node: c_int, 1054 | exclusive: bool, 1055 | arena_id: *mut mi_arena_id_t, 1056 | ) -> bool; 1057 | } 1058 | 1059 | #[cfg(test)] 1060 | mod tests { 1061 | use super::*; 1062 | use crate::mi_malloc; 1063 | 1064 | #[test] 1065 | fn it_calculates_usable_size() { 1066 | let ptr = unsafe { mi_malloc(32) } as *mut u8; 1067 | let usable_size = unsafe { mi_usable_size(ptr as *mut c_void) }; 1068 | assert!( 1069 | usable_size >= 32, 1070 | "usable_size should at least equal to the allocated size" 1071 | ); 1072 | } 1073 | 1074 | #[test] 1075 | fn runtime_stable_option() { 1076 | unsafe { 1077 | assert_eq!(mi_option_get(mi_option_show_errors), 0); 1078 | mi_option_set(mi_option_show_errors, 1); 1079 | assert_eq!(mi_option_get(mi_option_show_errors), 1); 1080 | 1081 | assert_eq!(mi_option_get(mi_option_show_stats), 0); 1082 | mi_option_set(mi_option_show_stats, 1); 1083 | assert_eq!(mi_option_get(mi_option_show_stats), 1); 1084 | 1085 | assert_eq!(mi_option_get(mi_option_verbose), 0); 1086 | mi_option_set(mi_option_verbose, 1); 1087 | assert_eq!(mi_option_get(mi_option_verbose), 1); 1088 | } 1089 | } 1090 | } 1091 | -------------------------------------------------------------------------------- /libmimalloc-sys/src/lib.rs: -------------------------------------------------------------------------------- 1 | #![no_std] 2 | // Copyright 2019 Octavian Oncescu 3 | 4 | use core::ffi::c_void; 5 | 6 | extern crate libc; 7 | 8 | #[cfg(feature = "extended")] 9 | mod extended; 10 | #[cfg(feature = "extended")] 11 | pub use extended::*; 12 | 13 | extern "C" { 14 | /// Allocate zero-initialized `size` bytes. 15 | /// 16 | /// Returns a pointer to newly allocated zero-initialized memory, or null if 17 | /// out of memory. 18 | pub fn mi_zalloc(size: usize) -> *mut c_void; 19 | 20 | /// Allocate `size` bytes. 21 | /// 22 | /// Returns pointer to the allocated memory or null if out of memory. 23 | /// Returns a unique pointer if called with `size` 0. 24 | pub fn mi_malloc(size: usize) -> *mut c_void; 25 | 26 | /// Re-allocate memory to `newsize` bytes. 27 | /// 28 | /// Return pointer to the allocated memory or null if out of memory. If null 29 | /// is returned, the pointer `p` is not freed. Otherwise the original 30 | /// pointer is either freed or returned as the reallocated result (in case 31 | /// it fits in-place with the new size). 32 | /// 33 | /// If `p` is null, it behaves as [`mi_malloc`]. If `newsize` is larger than 34 | /// the original `size` allocated for `p`, the bytes after `size` are 35 | /// uninitialized. 36 | pub fn mi_realloc(p: *mut c_void, newsize: usize) -> *mut c_void; 37 | 38 | /// Allocate `size` bytes aligned by `alignment`, initialized to zero. 39 | /// 40 | /// Return pointer to the allocated memory or null if out of memory. 41 | /// 42 | /// Returns a unique pointer if called with `size` 0. 43 | pub fn mi_zalloc_aligned(size: usize, alignment: usize) -> *mut c_void; 44 | 45 | /// Allocate `size` bytes aligned by `alignment`. 46 | /// 47 | /// Return pointer to the allocated memory or null if out of memory. 48 | /// 49 | /// Returns a unique pointer if called with `size` 0. 50 | pub fn mi_malloc_aligned(size: usize, alignment: usize) -> *mut c_void; 51 | 52 | /// Re-allocate memory to `newsize` bytes, aligned by `alignment`. 53 | /// 54 | /// Return pointer to the allocated memory or null if out of memory. If null 55 | /// is returned, the pointer `p` is not freed. Otherwise the original 56 | /// pointer is either freed or returned as the reallocated result (in case 57 | /// it fits in-place with the new size). 58 | /// 59 | /// If `p` is null, it behaves as [`mi_malloc_aligned`]. If `newsize` is 60 | /// larger than the original `size` allocated for `p`, the bytes after 61 | /// `size` are uninitialized. 62 | pub fn mi_realloc_aligned(p: *mut c_void, newsize: usize, alignment: usize) -> *mut c_void; 63 | 64 | /// Free previously allocated memory. 65 | /// 66 | /// The pointer `p` must have been allocated before (or be null). 67 | pub fn mi_free(p: *mut c_void); 68 | } 69 | 70 | #[cfg(test)] 71 | mod tests { 72 | use super::*; 73 | 74 | #[test] 75 | fn it_frees_memory_malloc() { 76 | let ptr = unsafe { mi_malloc_aligned(8, 8) } as *mut u8; 77 | unsafe { mi_free(ptr as *mut c_void) }; 78 | } 79 | 80 | #[test] 81 | fn it_frees_memory_zalloc() { 82 | let ptr = unsafe { mi_zalloc_aligned(8, 8) } as *mut u8; 83 | unsafe { mi_free(ptr as *mut c_void) }; 84 | } 85 | 86 | #[test] 87 | fn it_frees_memory_realloc() { 88 | let ptr = unsafe { mi_malloc_aligned(8, 8) } as *mut u8; 89 | let ptr = unsafe { mi_realloc_aligned(ptr as *mut c_void, 8, 8) } as *mut u8; 90 | unsafe { mi_free(ptr as *mut c_void) }; 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /libmimalloc-sys/sys-test/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "libmimalloc-sys-test" 3 | version = "0.1.0" 4 | authors = ["Thom Chiovoloni "] 5 | edition = "2018" 6 | description = "Bindings test for libmimalloc-sys" 7 | license = "MIT" 8 | publish = false 9 | 10 | [features] 11 | secure = ["libmimalloc-sys2/secure"] 12 | extended = ["libmimalloc-sys2/extended"] 13 | 14 | [dependencies] 15 | libmimalloc-sys2 = { path = "..", features = ["extended"] } 16 | libc = "0.2" 17 | 18 | [build-dependencies] 19 | ctest2 = "0.4" 20 | -------------------------------------------------------------------------------- /libmimalloc-sys/sys-test/build.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | let mut cfg = ctest2::TestGenerator::new(); 3 | cfg.header("mimalloc.h") 4 | .include(concat!( 5 | env!("CARGO_MANIFEST_DIR"), 6 | "/../c_src/mimalloc/include" 7 | )) 8 | .cfg("feature", Some("extended")) 9 | .fn_cname(|rust, link_name| link_name.unwrap_or(rust).to_string()) 10 | // ignore whether or not the option enum is signed. 11 | .skip_signededness(|c| c.ends_with("_t") || c.ends_with("_e")) 12 | .type_name(|ty, _is_struct, _is_union| { 13 | match ty { 14 | // Special cases. We do this to avoid having both 15 | // `mi_blah_{s,e}` and `mi_blah_t`. 16 | "mi_heap_area_t" => "struct mi_heap_area_s".into(), 17 | "mi_heap_t" => "struct mi_heap_s".into(), 18 | "mi_options_t" => "enum mi_options_e".into(), 19 | 20 | // This also works but requires we export `mi_heap_s` and similar 21 | // in addition, so we just hardcode the above. 22 | 23 | // t if t.ends_with("_s") => format!("struct {}", t), 24 | // t if t.ends_with("_e") => format!("enum {}", t), 25 | // t if t.ends_with("_t") => t.to_string(), 26 | 27 | // mimalloc defines it's callbacks with the pointer at the 28 | // location of use, e.g. `typedef ret mi_some_fun(a0 x, a1 y);` 29 | // and then uses `mi_some_fun *arg` as argument types, which 30 | // appears to upset ctest, which would prefer function pointers 31 | // be declared as pointers, so we clean things up for it. 32 | t if t.ends_with("_fun") => format!("{t}*"), 33 | 34 | t => t.to_string(), 35 | } 36 | }); 37 | 38 | cfg.generate("../src/lib.rs", "all.rs"); 39 | } 40 | -------------------------------------------------------------------------------- /libmimalloc-sys/sys-test/src/main.rs: -------------------------------------------------------------------------------- 1 | #![allow(bad_style, clippy::all)] 2 | 3 | use libmimalloc_sys2::*; 4 | 5 | include!(concat!(env!("OUT_DIR"), "/all.rs")); 6 | -------------------------------------------------------------------------------- /release-plz.toml: -------------------------------------------------------------------------------- 1 | [workspace] 2 | semver_check = true 3 | allow_dirty = true # The "fixtures" is being marked as dirty. 4 | changelog_config = "cliff.toml" 5 | -------------------------------------------------------------------------------- /renovate.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://docs.renovatebot.com/renovate-schema.json", 3 | "extends": [ 4 | "config:recommended" 5 | ] 6 | } 7 | -------------------------------------------------------------------------------- /src/extended.rs: -------------------------------------------------------------------------------- 1 | use crate::MiMalloc; 2 | use core::ffi::c_void; 3 | 4 | impl MiMalloc { 5 | /// Get the mimalloc version. 6 | /// 7 | /// For mimalloc version 1.8.6, this will return 186. 8 | pub fn version(&self) -> u32 { 9 | unsafe { ffi::mi_version() as u32 } 10 | } 11 | 12 | /// Return the amount of available bytes in a memory block. 13 | /// 14 | /// # Safety 15 | /// `ptr` must point to a memory block allocated by mimalloc, or be null. 16 | #[inline] 17 | pub unsafe fn usable_size(&self, ptr: *const u8) -> usize { 18 | ffi::mi_usable_size(ptr as *const c_void) 19 | } 20 | } 21 | 22 | #[cfg(test)] 23 | mod test { 24 | use super::*; 25 | use core::alloc::GlobalAlloc; 26 | use core::alloc::Layout; 27 | 28 | #[test] 29 | fn it_gets_version() { 30 | let version = MiMalloc.version(); 31 | assert!(version != 0); 32 | } 33 | 34 | #[test] 35 | fn it_checks_usable_size() { 36 | unsafe { 37 | let layout = Layout::from_size_align(8, 8).unwrap(); 38 | let alloc = MiMalloc; 39 | 40 | let ptr = alloc.alloc(layout); 41 | let usable_size = alloc.usable_size(ptr); 42 | alloc.dealloc(ptr, layout); 43 | assert!(usable_size >= 8); 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2019 Octavian Oncescu 2 | 3 | #![no_std] 4 | 5 | //! A drop-in global allocator wrapper around the [mimalloc](https://github.com/microsoft/mimalloc) allocator. 6 | //! Mimalloc is a general purpose, performance oriented allocator built by Microsoft. 7 | //! 8 | //! ## Usage 9 | //! ```rust,ignore 10 | //! use mimalloc::MiMalloc; 11 | //! 12 | //! #[global_allocator] 13 | //! static GLOBAL: MiMalloc = MiMalloc; 14 | //! ``` 15 | //! 16 | //! ## Usage with secure mode 17 | //! Using secure mode adds guard pages, 18 | //! randomized allocation, encrypted free lists, etc. The performance penalty is usually 19 | //! around 10% according to [mimalloc's](https://github.com/microsoft/mimalloc) 20 | //! own benchmarks. 21 | //! 22 | //! To enable secure mode, put in `Cargo.toml`: 23 | //! ```rust,ignore 24 | //! [dependencies] 25 | //! mimalloc = { version = "*", features = ["secure"] } 26 | //! ``` 27 | 28 | extern crate libmimalloc_sys2 as ffi; 29 | 30 | #[cfg(feature = "extended")] 31 | mod extended; 32 | 33 | use core::alloc::{GlobalAlloc, Layout}; 34 | use core::ffi::c_void; 35 | use ffi::*; 36 | 37 | /// Drop-in mimalloc global allocator. 38 | /// 39 | /// ## Usage 40 | /// ```rust,ignore 41 | /// use mimalloc::MiMalloc; 42 | /// 43 | /// #[global_allocator] 44 | /// static GLOBAL: MiMalloc = MiMalloc; 45 | /// ``` 46 | pub struct MiMalloc; 47 | 48 | unsafe impl GlobalAlloc for MiMalloc { 49 | #[inline] 50 | unsafe fn alloc(&self, layout: Layout) -> *mut u8 { 51 | mi_malloc_aligned(layout.size(), layout.align()) as *mut u8 52 | } 53 | 54 | #[inline] 55 | unsafe fn alloc_zeroed(&self, layout: Layout) -> *mut u8 { 56 | mi_zalloc_aligned(layout.size(), layout.align()) as *mut u8 57 | } 58 | 59 | #[inline] 60 | unsafe fn dealloc(&self, ptr: *mut u8, _layout: Layout) { 61 | mi_free(ptr as *mut c_void); 62 | } 63 | 64 | #[inline] 65 | unsafe fn realloc(&self, ptr: *mut u8, layout: Layout, new_size: usize) -> *mut u8 { 66 | mi_realloc_aligned(ptr as *mut c_void, new_size, layout.align()) as *mut u8 67 | } 68 | } 69 | 70 | #[cfg(test)] 71 | mod tests { 72 | use super::*; 73 | 74 | #[test] 75 | fn it_frees_allocated_memory() { 76 | unsafe { 77 | let layout = Layout::from_size_align(8, 8).unwrap(); 78 | let alloc = MiMalloc; 79 | 80 | let ptr = alloc.alloc(layout); 81 | alloc.dealloc(ptr, layout); 82 | } 83 | } 84 | 85 | #[test] 86 | fn it_frees_allocated_big_memory() { 87 | unsafe { 88 | let layout = Layout::from_size_align(1 << 20, 32).unwrap(); 89 | let alloc = MiMalloc; 90 | 91 | let ptr = alloc.alloc(layout); 92 | alloc.dealloc(ptr, layout); 93 | } 94 | } 95 | 96 | #[test] 97 | fn it_frees_zero_allocated_memory() { 98 | unsafe { 99 | let layout = Layout::from_size_align(8, 8).unwrap(); 100 | let alloc = MiMalloc; 101 | 102 | let ptr = alloc.alloc_zeroed(layout); 103 | alloc.dealloc(ptr, layout); 104 | } 105 | } 106 | 107 | #[test] 108 | fn it_frees_zero_allocated_big_memory() { 109 | unsafe { 110 | let layout = Layout::from_size_align(1 << 20, 32).unwrap(); 111 | let alloc = MiMalloc; 112 | 113 | let ptr = alloc.alloc_zeroed(layout); 114 | alloc.dealloc(ptr, layout); 115 | } 116 | } 117 | 118 | #[test] 119 | fn it_frees_reallocated_memory() { 120 | unsafe { 121 | let layout = Layout::from_size_align(8, 8).unwrap(); 122 | let alloc = MiMalloc; 123 | 124 | let ptr = alloc.alloc(layout); 125 | let ptr = alloc.realloc(ptr, layout, 16); 126 | alloc.dealloc(ptr, layout); 127 | } 128 | } 129 | 130 | #[test] 131 | fn it_frees_reallocated_big_memory() { 132 | unsafe { 133 | let layout = Layout::from_size_align(1 << 20, 32).unwrap(); 134 | let alloc = MiMalloc; 135 | 136 | let ptr = alloc.alloc(layout); 137 | let ptr = alloc.realloc(ptr, layout, 2 << 20); 138 | alloc.dealloc(ptr, layout); 139 | } 140 | } 141 | } 142 | --------------------------------------------------------------------------------