Skip to content

Commit 87cc20c

Browse files
authored
Merge pull request #5 from leshow/change_name
Change name to bc-mimalloc
2 parents 9f614ef + c7eba6b commit 87cc20c

9 files changed

Lines changed: 51 additions & 18 deletions

File tree

.github/workflows/ci.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
pull_request:
66
# Run daily to catch when Rust updates cause problems to happen.
77
schedule:
8-
- cron: '00 01 * * *'
8+
- cron: "00 01 * * *"
99

1010
jobs:
1111
rust:
@@ -115,7 +115,6 @@ jobs:
115115
name: Check documentation
116116
runs-on: ubuntu-latest
117117
steps:
118-
119118
- uses: actions/checkout@v4
120119
with:
121120
submodules: recursive
@@ -127,8 +126,8 @@ jobs:
127126
# gets us the nicer syntax for linking to functions, and is in-line with
128127
# what docs.rs uses.
129128

130-
- name: 'Check documentation links in `mimalloc`'
129+
- name: "Check documentation links in `mimalloc`"
131130
run: cargo rustdoc -- -D warnings
132131

133-
- name: 'Check documentation links in `libmimalloc-sys`'
134-
run: cargo rustdoc -p libmimalloc-sys -- -D warnings
132+
- name: "Check documentation links in `bc-libmimalloc-sys`"
133+
run: cargo rustdoc -p bc-libmimalloc-sys -- -D warnings

Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
[package]
2-
name = "mimalloc"
2+
name = "bc-mimalloc"
33
version = "0.1.48"
44
authors = [
55
"Octavian Oncescu <octavonce@gmail.com>",
66
"Vincent Rouillé <vincent@speedy37.fr>",
77
"Thom Chiovoloni <chiovolonit@gmail.com>",
88
]
99
edition = "2018"
10-
repository = "https://github.com/purpleprotocol/mimalloc_rust"
10+
repository = "https://github.com/leshow/mimalloc_rust"
1111
keywords = ["mimalloc", "allocator", "encrypted-heap", "performance"]
1212
categories = ["memory-management", "api-bindings"]
13-
description = "Performance and security oriented drop-in allocator"
13+
description = "Performance and security oriented drop-in allocator (updated to v2.2.7 and v3.2.8, respectively)"
1414
license = "MIT"
1515
readme = "README.md"
1616

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

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

3030
[features]
3131
default = []

libmimalloc-sys/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
[package]
2-
name = "libmimalloc-sys"
2+
name = "bc-libmimalloc-sys"
33
version = "0.1.44"
44
authors = ["Octavian Oncescu <octavonce@gmail.com>"]
55
edition = "2018"
6-
repository = "https://github.com/purpleprotocol/mimalloc_rust/tree/master/libmimalloc-sys"
6+
repository = "https://github.com/leshow/mimalloc_rust/tree/master/libmimalloc-sys"
77
keywords = ["allocator", "encrypted-heap", "performance"]
88
categories = ["memory-management", "api-bindings"]
9-
description = "Sys crate wrapping the mimalloc allocator"
9+
description = "Sys crate wrapping the mimalloc allocator (updated to v2.2.7 and v3.2.8, respectively)"
1010
license = "MIT"
1111
links = "mimalloc"
1212
exclude = [

libmimalloc-sys/build.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ fn main() {
8989
// For instance, on certain platforms, llvm has relocated the atomic of the arm32 architecture to libclang_rt.builtins.a
9090
// while some use libatomic.a, and others use libatomic_ops.a.
9191
let atomic_name = env::var("DEP_ATOMIC").unwrap_or("atomic".to_owned());
92-
println!("cargo:rustc-link-lib={}", atomic_name);
92+
println!("cargo:rustc-link-lib={atomic_name}");
9393
}
9494

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

100100
for lib in libs {
101-
println!("cargo:rustc-link-lib={}", lib);
101+
println!("cargo:rustc-link-lib={lib}");
102102
}
103103
}
104104
}

libmimalloc-sys/src/extended.rs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,9 @@ extern "C" {
314314
/// Merge thread local statistics with the main statistics and reset.
315315
///
316316
/// Note: This function is thread safe.
317+
///
318+
/// Note: not available in v3 (declared in header but not implemented).
319+
#[cfg(not(feature = "v3"))]
317320
pub fn mi_stats_merge();
318321

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

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

530536
/// Option (experimental) Pretend there are at most N NUMA nodes; Use 0 to use the actual detected NUMA nodes at runtime.
@@ -965,12 +971,34 @@ extern "C" {
965971
/// Returns `true` if all areas and blocks were visited.
966972
///
967973
/// Passing a `None` visitor is allowed, and is a no-op.
974+
#[cfg(not(feature = "v3"))]
968975
pub fn mi_heap_visit_blocks(
969976
heap: *const mi_heap_t,
970977
visit_all_blocks: bool,
971978
visitor: mi_block_visit_fun,
972979
arg: *mut c_void,
973980
) -> bool;
981+
/// Visit all areas and blocks in `heap`.
982+
///
983+
/// If `visit_all_blocks` is false, the `visitor` is only called once for
984+
/// every heap area. If it's true, the `visitor` is also called for every
985+
/// allocated block inside every area (with `!block.is_null()`). Return
986+
/// `false` from the `visitor` to return early.
987+
///
988+
/// `arg` is an extra argument passed into the `visitor`.
989+
///
990+
/// Returns `true` if all areas and blocks were visited.
991+
///
992+
/// Passing a `None` visitor is allowed, and is a no-op.
993+
///
994+
/// Note: in v3 the `heap` parameter is non-const compared to v2.
995+
#[cfg(feature = "v3")]
996+
pub fn mi_heap_visit_blocks(
997+
heap: *mut mi_heap_t,
998+
visit_all_blocks: bool,
999+
visitor: mi_block_visit_fun,
1000+
arg: *mut c_void,
1001+
) -> bool;
9741002

9751003
#[cfg(feature = "arena")]
9761004
/// Create a heap that only allocates in the specified arena

libmimalloc-sys/sys-test/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ license = "MIT"
88
publish = false
99

1010
[dependencies]
11-
libmimalloc-sys = { path = ".." }
11+
libmimalloc-sys = { package = "bc-libmimalloc-sys", path = ".." }
1212
libc = "0.2"
1313

1414
[build-dependencies]

libmimalloc-sys/sys-test/build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ fn main() {
4949
// and then uses `mi_some_fun *arg` as argument types, which
5050
// appears to upset ctest, which would prefer function pointers
5151
// be declared as pointers, so we clean things up for it.
52-
t if t.ends_with("_fun") => format!("{}*", t),
52+
t if t.ends_with("_fun") => format!("{t}*"),
5353

5454
t => t.to_string(),
5555
}

libmimalloc-sys/sys-test/src/main.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
#![allow(bad_style, unused_imports, unused_macros, clippy::all)]
1+
#![allow(
2+
bad_style,
3+
unused_imports,
4+
unused_macros,
5+
clippy::all,
6+
function_casts_as_integer
7+
)]
28

39
use libmimalloc_sys::*;
410

test-override-with-dylib/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ publish = false
88

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

1313
[build-dependencies]
1414
cc = "^1.0.13"

0 commit comments

Comments
 (0)