We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent de45b6f commit 8f2a80cCopy full SHA for 8f2a80c
src/lib.rs
@@ -63,9 +63,12 @@ unsafe impl GlobalAlloc for MiMalloc {
63
}
64
65
impl MiMalloc {
66
- #[allow(dead_code)]
+ /// Return the amount of available bytes in a memory block.
67
+ ///
68
+ /// # Safety
69
+ /// `ptr` must point to a memory block allocated by mimalloc, or be null.
70
#[inline]
- unsafe fn usable_size(&self, ptr: *const u8) -> usize {
71
+ pub unsafe fn usable_size(&self, ptr: *const u8) -> usize {
72
mi_usable_size(ptr as *const c_void)
73
74
@@ -143,7 +146,7 @@ mod tests {
143
146
144
147
145
148
#[test]
- fn it_usable_size() {
149
+ fn it_checks_usable_size() {
150
unsafe {
151
let layout = Layout::from_size_align(8, 8).unwrap();
152
let alloc = MiMalloc;
0 commit comments