Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion scripts/build/deps/mimalloc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

import type { Dependency, DirectBuild } from "../source.ts";

const MIMALLOC_COMMIT = "24211c6e7610ae7c4ec06040758ec90bd21a1c83";
const MIMALLOC_COMMIT = "65b95f778e21fb4f317a87a66426024b9b83d1f7";

export const mimalloc: Dependency = {
name: "mimalloc",
Expand Down
5 changes: 5 additions & 0 deletions src/bun_bin/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,11 @@ pub unsafe extern "C" fn main(argc: c_int, argv: *const *const c_char) -> c_int
libc::signal(libc::SIGXFSZ, libc::SIG_IGN);
}

// 1.5. Start mimalloc's background scavenger thread. mimalloc leaves
// that to the application instead of spawning it during process
// init; after the signal setup above so it stays single-threaded.
bun_alloc::mimalloc::mi_scavenger_start();

// Windows-only startup. Must run BEFORE the first libuv
// call (uv allocator) and before anything reads `Bun.env`/`process.env`
// (env conversion).
Expand Down
4 changes: 4 additions & 0 deletions src/mimalloc_sys/mimalloc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ unsafe extern "C" {
/// free blocks inside its still-used pages, and hands the arena purge to the scavenger.
/// Safe on any thread; a no-op on a thread that never allocated. No preconditions.
pub safe fn mi_on_thread_idle();
/// Start the background scavenger thread that purges freed arena memory off-thread.
/// mimalloc does not start it on its own; until this is called purging stays
/// allocation-driven. Idempotent; no preconditions.
pub safe fn mi_scavenger_start();
/// No preconditions.
pub safe fn mi_version() -> c_int;
/// No preconditions.
Expand Down
2 changes: 1 addition & 1 deletion test/js/node/process/process.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ it("process.versions", () => {
const expectedVersions = {
boringssl: "1a41b9025c2c0a37edd07ff10f6944f03e028522",
libarchive: "ded82291ab41d5e355831b96b0e1ff49e24d8939",
mimalloc: "24211c6e7610ae7c4ec06040758ec90bd21a1c83",
mimalloc: "65b95f778e21fb4f317a87a66426024b9b83d1f7",
picohttpparser: "066d2b1e9ab820703db0837a7255d92d30f0c9f5",
zlib: "12731092979c6d07f42da27da673a9f6c7b13586",
tinycc: "12882eee073cfe5c7621bcfadf679e1372d4537b",
Expand Down
Loading