Skip to content

Commit 859fbc1

Browse files
authored
Merge pull request #122 from michel-slm/fix-usable-size-gating
Fix mi_usable_size gating
2 parents a9c410c + 4b809e2 commit 859fbc1

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

libmimalloc-sys/src/extended.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1013,6 +1013,16 @@ extern "C" {
10131013
mod tests {
10141014
use super::*;
10151015

1016+
#[test]
1017+
fn it_calculates_usable_size() {
1018+
let ptr = unsafe { mi_malloc(32) } as *mut u8;
1019+
let usable_size = unsafe { mi_usable_size(ptr as *mut c_void) };
1020+
assert!(
1021+
usable_size >= 32,
1022+
"usable_size should at least equal to the allocated size"
1023+
);
1024+
}
1025+
10161026
#[test]
10171027
fn runtime_stable_option() {
10181028
unsafe {

libmimalloc-sys/src/lib.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -89,14 +89,4 @@ mod tests {
8989
let ptr = unsafe { mi_realloc_aligned(ptr as *mut c_void, 8, 8) } as *mut u8;
9090
unsafe { mi_free(ptr as *mut c_void) };
9191
}
92-
93-
#[test]
94-
fn it_calculates_usable_size() {
95-
let ptr = unsafe { mi_malloc(32) } as *mut u8;
96-
let usable_size = unsafe { mi_usable_size(ptr as *mut c_void) };
97-
assert!(
98-
usable_size >= 32,
99-
"usable_size should at least equal to the allocated size"
100-
);
101-
}
10292
}

0 commit comments

Comments
 (0)