Skip to content

Commit

Permalink
deps: switch to tikv-jemallocator crates in Cargo.toml
Browse files Browse the repository at this point in the history
`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 servo#32720. There doesn't seem to be a
corresponding version publised for the `jemallocator` crate.

Fixes servo#32720

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
  • Loading branch information
mukilan committed Jul 22, 2024
1 parent f6dc35f commit d28de56
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 32 deletions.
46 changes: 23 additions & 23 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions components/allocator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
6 changes: 3 additions & 3 deletions components/allocator/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,20 @@ 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.
///
/// # Safety
///
/// 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};
}
}

Expand Down
2 changes: 1 addition & 1 deletion components/profile/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
2 changes: 1 addition & 1 deletion components/profile/mem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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> {
Expand Down

0 comments on commit d28de56

Please sign in to comment.