Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
e13100a7
Unverified
Commit
e13100a7
authored
Jan 14, 2026
by
Niklas Mischkulnig
Committed by
GitHub
Jan 14, 2026
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Backport] mimalloc upgrade and enabling it on musl (#88503)
Co-authored-by:
xusd320
<
xusd320@gmail.com
>
parent
beb3a766
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
42 deletions
+29
-42
Cargo.lock
Cargo.lock
+16
-17
Cargo.toml
turbopack/crates/turbo-tasks-malloc/Cargo.toml
+7
-7
lib.rs
turbopack/crates/turbo-tasks-malloc/src/lib.rs
+6
-18
No files found.
Cargo.lock
View file @
e13100a7
...
@@ -3642,6 +3642,17 @@ dependencies = [
...
@@ -3642,6 +3642,17 @@ dependencies = [
"windows-sys 0.48.0",
"windows-sys 0.48.0",
]
]
[[package]]
name = "libmimalloc-sys"
version = "0.1.44"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "667f4fec20f29dfc6bc7357c582d91796c169ad7e2fce709468aefeb2c099870"
dependencies = [
"cc",
"cty",
"libc",
]
[[package]]
[[package]]
name = "libunwind"
name = "libunwind"
version = "1.3.3"
version = "1.3.3"
...
@@ -3997,12 +4008,12 @@ dependencies = [
...
@@ -3997,12 +4008,12 @@ dependencies = [
]
]
[[package]]
[[package]]
name = "mimalloc
-rspack
"
name = "mimalloc"
version = "0.
2.4
"
version = "0.
1.48
"
source = "registry+https://github.com/rust-lang/crates.io-index"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "
de20bb33bf95d9c060030d53bcb5d5dc03cbbedfbd1dcda5f6f285b946dae2c0
"
checksum = "
e1ee66a4b64c74f4ef288bcbb9192ad9c3feaad75193129ac8509af543894fd8
"
dependencies = [
dependencies = [
"
rspack-
libmimalloc-sys",
"libmimalloc-sys",
]
]
[[package]]
[[package]]
...
@@ -6042,17 +6053,6 @@ dependencies = [
...
@@ -6042,17 +6053,6 @@ dependencies = [
"serde",
"serde",
]
]
[[package]]
name = "rspack-libmimalloc-sys"
version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4c741844b1fbe0cfbae8dfeb73b5e5fdc95daf7be58bdd72afb3fd85c86bccdb"
dependencies = [
"cc",
"cty",
"libc",
]
[[package]]
[[package]]
name = "rstest"
name = "rstest"
version = "0.16.0"
version = "0.16.0"
...
@@ -9437,8 +9437,7 @@ dependencies = [
...
@@ -9437,8 +9437,7 @@ dependencies = [
name = "turbo-tasks-malloc"
name = "turbo-tasks-malloc"
version = "0.1.0"
version = "0.1.0"
dependencies = [
dependencies = [
"mimalloc-rspack",
"mimalloc",
"rspack-libmimalloc-sys",
]
]
[[package]]
[[package]]
...
...
turbopack/crates/turbo-tasks-malloc/Cargo.toml
View file @
e13100a7
...
@@ -10,21 +10,21 @@ autobenches = false
...
@@ -10,21 +10,21 @@ autobenches = false
bench
=
false
bench
=
false
[dependencies]
[dependencies]
rspack-libmimalloc-sys
=
{
version
=
"0.2.4"
,
default-features
=
false
,
features
=
[],
optional
=
true
}
[target.'cfg(not(any(target_os
=
"linux"
,
target_family
=
"wasm"
,
target_env
=
"musl"
)))'.dependencies]
mimalloc-rspack
=
{
version
=
"0.2.4"
,
features
=
[
[target.'cfg(not(any(target_os
=
"linux"
,
target_family
=
"wasm"
)))'.dependencies]
mimalloc
=
{
version
=
"0.1.48"
,
features
=
[
"v3"
,
"v3"
,
"extended"
"extended"
,
],
optional
=
true
}
],
optional
=
true
}
[target.'cfg(all(target_os
=
"linux"
,
not(
any(target_family
=
"wasm"
,
target_env
=
"musl"
)
)))'.dependencies]
[target.'cfg(all(target_os
=
"linux"
,
not(
target_family
=
"wasm"
)))'.dependencies]
mimalloc
-rspack
=
{
version
=
"0.2.4
"
,
features
=
[
mimalloc
=
{
version
=
"0.1.48
"
,
features
=
[
"v3"
,
"v3"
,
"extended"
,
"extended"
,
"local_dynamic_tls"
,
"local_dynamic_tls"
,
],
optional
=
true
}
],
optional
=
true
}
[features]
[features]
custom_allocator
=
[
"dep:mimalloc
-rspack"
,
"dep:rspack-libmimalloc-sys
"
]
custom_allocator
=
["dep:mimalloc"]
default
=
["custom_allocator"]
default
=
["custom_allocator"]
turbopack/crates/turbo-tasks-malloc/src/lib.rs
View file @
e13100a7
...
@@ -114,29 +114,17 @@ impl TurboMalloc {
...
@@ -114,29 +114,17 @@ impl TurboMalloc {
/// Get the allocator for this platform that we should wrap with TurboMalloc.
/// Get the allocator for this platform that we should wrap with TurboMalloc.
#[inline]
#[inline]
fn
base_alloc
()
->
&
'static
impl
GlobalAlloc
{
fn
base_alloc
()
->
&
'static
impl
GlobalAlloc
{
#[cfg(all(
#[cfg(all(feature
=
"custom_allocator"
,
not(target_family
=
"wasm"
)))]
feature
=
"custom_allocator"
,
return
&
mimalloc
::
MiMalloc
;
not(any(target_family
=
"wasm"
,
target_env
=
"musl"
))
#[cfg(not(all(feature
=
"custom_allocator"
,
not(target_family
=
"wasm"
))))]
))]
return
&
mimalloc_rspack
::
MiMalloc
;
#[cfg(any(
not(feature
=
"custom_allocator"
),
any(target_family
=
"wasm"
,
target_env
=
"musl"
)
))]
return
&
std
::
alloc
::
System
;
return
&
std
::
alloc
::
System
;
}
}
#[allow(unused_variables)]
#[allow(unused_variables)]
unsafe
fn
base_alloc_size
(
ptr
:
*
const
u8
,
layout
:
Layout
)
->
usize
{
unsafe
fn
base_alloc_size
(
ptr
:
*
const
u8
,
layout
:
Layout
)
->
usize
{
#[cfg(all(
#[cfg(all(feature
=
"custom_allocator"
,
not(target_family
=
"wasm"
)))]
feature
=
"custom_allocator"
,
return
unsafe
{
mimalloc
::
MiMalloc
.usable_size
(
ptr
)
};
not(any(target_family
=
"wasm"
,
target_env
=
"musl"
))
#[cfg(not(all(feature
=
"custom_allocator"
,
not(target_family
=
"wasm"
))))]
))]
return
unsafe
{
mimalloc_rspack
::
MiMalloc
.usable_size
(
ptr
)
};
#[cfg(any(
not(feature
=
"custom_allocator"
),
any(target_family
=
"wasm"
,
target_env
=
"musl"
)
))]
return
layout
.size
();
return
layout
.size
();
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment