deps: switch to tikv-jemallocator crates in Cargo.toml (#32828)

`jemallocator` and `jemallocator-sys` crates are same as the `tikv-*`
versions and these aliases were maintained for historical reasons, based
on crates.io documentation. For newer projects, it is recommended to use
the `tikv-` versions of the crate. Even though Servo is not a new
project, it makes sense to switch to the newer version for the sake of
clarity.

Also, more importantly, `tikv-jemallocator` has new release (0.6.0)
which includes a fix for #32720. There doesn't seem to be a
corresponding version publised for the `jemallocator` crate.

Fixes #32720

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
This commit is contained in:
Mukilan Thiyagarajan 2024-07-22 13:25:46 +05:30 committed by GitHub
parent f6dc35f11d
commit a007baa4cf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 32 additions and 32 deletions

46
Cargo.lock generated
View file

@ -3233,26 +3233,6 @@ version = "1.0.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b"
[[package]]
name = "jemalloc-sys"
version = "0.5.4+5.3.0-patched"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac6c1946e1cea1788cbfde01c993b52a10e2da07f4bac608228d1bed20bfebf2"
dependencies = [
"cc",
"libc",
]
[[package]]
name = "jemallocator"
version = "0.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a0de374a9f8e63150e6f5e8a60cc14c668226d7a347d8aee1a45766e3c4dd3bc"
dependencies = [
"jemalloc-sys",
"libc",
]
[[package]]
name = "jni"
version = "0.21.1"
@ -4808,7 +4788,6 @@ name = "profile"
version = "0.0.1"
dependencies = [
"ipc-channel",
"jemalloc-sys",
"libc",
"profile_traits",
"regex",
@ -4816,6 +4795,7 @@ dependencies = [
"serde_json",
"servo_config",
"task_info",
"tikv-jemalloc-sys",
]
[[package]]
@ -5698,9 +5678,9 @@ dependencies = [
name = "servo_allocator"
version = "0.0.1"
dependencies = [
"jemalloc-sys",
"jemallocator",
"libc",
"tikv-jemalloc-sys",
"tikv-jemallocator",
"windows-sys 0.52.0",
]
@ -6432,6 +6412,26 @@ dependencies = [
"weezl",
]
[[package]]
name = "tikv-jemalloc-sys"
version = "0.6.0+5.3.0-1-ge13ca993e8ccb9ba9847cc330696e02839f328f7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cd3c60906412afa9c2b5b5a48ca6a5abe5736aec9eb48ad05037a677e52e4e2d"
dependencies = [
"cc",
"libc",
]
[[package]]
name = "tikv-jemallocator"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4cec5ff18518d81584f477e9bfdf957f5bb0979b0bac3af4ca30b5b3ae2d2865"
dependencies = [
"libc",
"tikv-jemalloc-sys",
]
[[package]]
name = "time"
version = "0.1.45"

View file

@ -69,8 +69,8 @@ imsz = "0.2"
indexmap = { version = "2.2.6", features = ["std"] }
ipc-channel = "0.18"
itertools = "0.13"
jemalloc-sys = "0.5.4"
jemallocator = "0.5.4"
tikv-jemalloc-sys = "0.6.0"
tikv-jemallocator = "0.6.0"
keyboard-types = "0.7"
lazy_static = "1.5"
libc = "0.2"

View file

@ -13,8 +13,8 @@ path = "lib.rs"
use-system-allocator = ["libc"]
[target.'cfg(not(any(windows, target_env = "ohos")))'.dependencies]
jemallocator = { workspace = true }
jemalloc-sys = { workspace = true }
tikv-jemallocator = { workspace = true }
tikv-jemalloc-sys = { workspace = true }
libc = { workspace = true, optional = true }
[target.'cfg(windows)'.dependencies]

View file

@ -13,7 +13,7 @@ pub use crate::platform::*;
mod platform {
use std::os::raw::c_void;
pub use jemallocator::Jemalloc as Allocator;
pub use tikv_jemallocator::Jemalloc as Allocator;
/// Get the size of a heap block.
///
@ -21,12 +21,12 @@ mod platform {
///
/// Passing a non-heap allocated pointer to this function results in undefined behavior.
pub unsafe extern "C" fn usable_size(ptr: *const c_void) -> usize {
jemallocator::usable_size(ptr)
tikv_jemallocator::usable_size(ptr)
}
/// Memory allocation APIs compatible with libc
pub mod libc_compat {
pub use jemalloc_sys::{free, malloc, realloc};
pub use tikv_jemalloc_sys::{free, malloc, realloc};
}
}

View file

@ -26,4 +26,4 @@ regex = { workspace = true }
[target.'cfg(not(target_os = "windows"))'.dependencies]
libc = { workspace = true }
[target.'cfg(not(any(target_os = "windows", target_env = "ohos")))'.dependencies]
jemalloc-sys = { workspace = true }
tikv-jemalloc-sys = { workspace = true }

View file

@ -500,7 +500,7 @@ mod system_reporter {
}
#[cfg(not(any(target_os = "windows", target_env = "ohos")))]
use jemalloc_sys::mallctl;
use tikv_jemalloc_sys::mallctl;
#[cfg(not(any(target_os = "windows", target_env = "ohos")))]
fn jemalloc_stat(value_name: &str) -> Option<usize> {