Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
9 changes: 4 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
pull_request:
# Run daily to catch when Rust updates cause problems to happen.
schedule:
- cron: '00 01 * * *'
- cron: "00 01 * * *"

jobs:
rust:
Expand Down Expand Up @@ -115,7 +115,6 @@ jobs:
name: Check documentation
runs-on: ubuntu-latest
steps:

- uses: actions/checkout@v4
with:
submodules: recursive
Expand All @@ -127,8 +126,8 @@ jobs:
# gets us the nicer syntax for linking to functions, and is in-line with
# what docs.rs uses.

- name: 'Check documentation links in `mimalloc`'
- name: "Check documentation links in `mimalloc`"
run: cargo rustdoc -- -D warnings

- name: 'Check documentation links in `libmimalloc-sys`'
run: cargo rustdoc -p libmimalloc-sys -- -D warnings
- name: "Check documentation links in `bc-libmimalloc-sys`"
run: cargo rustdoc -p bc-libmimalloc-sys -- -D warnings
8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
[package]
name = "mimalloc"
name = "bc-mimalloc"
version = "0.1.48"
authors = [
"Octavian Oncescu <octavonce@gmail.com>",
"Vincent Rouillé <vincent@speedy37.fr>",
"Thom Chiovoloni <chiovolonit@gmail.com>",
]
edition = "2018"
repository = "https://github.com/purpleprotocol/mimalloc_rust"
repository = "https://github.com/leshow/mimalloc_rust"
keywords = ["mimalloc", "allocator", "encrypted-heap", "performance"]
categories = ["memory-management", "api-bindings"]
description = "Performance and security oriented drop-in allocator"
description = "Performance and security oriented drop-in allocator (updated to v2.2.7 and v3.2.8, respectively)"
license = "MIT"
readme = "README.md"

Expand All @@ -25,7 +25,7 @@ members = [
travis-ci = { repository = "purpleprotocol/mimalloc_rust" }

[dependencies]
libmimalloc-sys = { path = "libmimalloc-sys", version = "0.1.44", default-features = false }
libmimalloc-sys = { package = "bc-libmimalloc-sys", path = "libmimalloc-sys", version = "0.1.44", default-features = false }

[features]
default = []
Expand Down
6 changes: 3 additions & 3 deletions libmimalloc-sys/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
[package]
name = "libmimalloc-sys"
name = "bc-libmimalloc-sys"
version = "0.1.44"
authors = ["Octavian Oncescu <octavonce@gmail.com>"]
edition = "2018"
repository = "https://github.com/purpleprotocol/mimalloc_rust/tree/master/libmimalloc-sys"
repository = "https://github.com/leshow/mimalloc_rust/tree/master/libmimalloc-sys"
keywords = ["allocator", "encrypted-heap", "performance"]
categories = ["memory-management", "api-bindings"]
description = "Sys crate wrapping the mimalloc allocator"
description = "Sys crate wrapping the mimalloc allocator (updated to v2.2.7 and v3.2.8, respectively)"
license = "MIT"
links = "mimalloc"
exclude = [
Expand Down
4 changes: 2 additions & 2 deletions libmimalloc-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ fn main() {
// For instance, on certain platforms, llvm has relocated the atomic of the arm32 architecture to libclang_rt.builtins.a
// while some use libatomic.a, and others use libatomic_ops.a.
let atomic_name = env::var("DEP_ATOMIC").unwrap_or("atomic".to_owned());
println!("cargo:rustc-link-lib={}", atomic_name);
println!("cargo:rustc-link-lib={atomic_name}");
}

// Link with libs needed on Windows
Expand All @@ -98,7 +98,7 @@ fn main() {
let libs = ["psapi", "shell32", "user32", "advapi32", "bcrypt"];

for lib in libs {
println!("cargo:rustc-link-lib={}", lib);
println!("cargo:rustc-link-lib={lib}");
}
}
}
28 changes: 28 additions & 0 deletions libmimalloc-sys/src/extended.rs
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,9 @@ extern "C" {
/// Merge thread local statistics with the main statistics and reset.
///
/// Note: This function is thread safe.
///
/// Note: not available in v3 (declared in header but not implemented).
#[cfg(not(feature = "v3"))]
pub fn mi_stats_merge();

/// Return the mimalloc version number.
Expand Down Expand Up @@ -525,6 +528,9 @@ pub const mi_option_reserve_huge_os_pages_at: mi_option_t = 8;
pub const mi_option_reserve_os_memory: mi_option_t = 9;

/// Option (experimental) the first N segments per thread are not eagerly committed (=1).
///
/// Note: removed/renamed in v3 (`mi_option_deprecated_eager_commit_delay`).
#[cfg(not(feature = "v3"))]
pub const mi_option_eager_commit_delay: mi_option_t = 14;

/// Option (experimental) Pretend there are at most N NUMA nodes; Use 0 to use the actual detected NUMA nodes at runtime.
Expand Down Expand Up @@ -965,12 +971,34 @@ extern "C" {
/// Returns `true` if all areas and blocks were visited.
///
/// Passing a `None` visitor is allowed, and is a no-op.
#[cfg(not(feature = "v3"))]
pub fn mi_heap_visit_blocks(
heap: *const mi_heap_t,
visit_all_blocks: bool,
visitor: mi_block_visit_fun,
arg: *mut c_void,
) -> bool;
/// Visit all areas and blocks in `heap`.
///
/// If `visit_all_blocks` is false, the `visitor` is only called once for
/// every heap area. If it's true, the `visitor` is also called for every
/// allocated block inside every area (with `!block.is_null()`). Return
/// `false` from the `visitor` to return early.
///
/// `arg` is an extra argument passed into the `visitor`.
///
/// Returns `true` if all areas and blocks were visited.
///
/// Passing a `None` visitor is allowed, and is a no-op.
///
/// Note: in v3 the `heap` parameter is non-const compared to v2.
#[cfg(feature = "v3")]
pub fn mi_heap_visit_blocks(
heap: *mut mi_heap_t,
visit_all_blocks: bool,
visitor: mi_block_visit_fun,
arg: *mut c_void,
) -> bool;

#[cfg(feature = "arena")]
/// Create a heap that only allocates in the specified arena
Expand Down
2 changes: 1 addition & 1 deletion libmimalloc-sys/sys-test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ license = "MIT"
publish = false

[dependencies]
libmimalloc-sys = { path = ".." }
libmimalloc-sys = { package = "bc-libmimalloc-sys", path = ".." }
libc = "0.2"

[build-dependencies]
Expand Down
2 changes: 1 addition & 1 deletion libmimalloc-sys/sys-test/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ fn main() {
// and then uses `mi_some_fun *arg` as argument types, which
// appears to upset ctest, which would prefer function pointers
// be declared as pointers, so we clean things up for it.
t if t.ends_with("_fun") => format!("{}*", t),
t if t.ends_with("_fun") => format!("{t}*"),

t => t.to_string(),
}
Expand Down
8 changes: 7 additions & 1 deletion libmimalloc-sys/sys-test/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
#![allow(bad_style, unused_imports, unused_macros, clippy::all)]
#![allow(
bad_style,
unused_imports,
unused_macros,
clippy::all,
function_casts_as_integer
)]

use libmimalloc_sys::*;

Expand Down
2 changes: 1 addition & 1 deletion test-override-with-dylib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ publish = false

[dependencies]
libc = { version = "^0.2.8", default-features = false }
libmimalloc-sys = { path = "../libmimalloc-sys" }
libmimalloc-sys = { package = "bc-libmimalloc-sys", path = "../libmimalloc-sys" }

[build-dependencies]
cc = "^1.0.13"
Expand Down