File tree 3 files changed +5
-5
lines changed 3 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ documentation = "https://docs.rs/buddy_system_allocator"
5
5
homepage = " https://github.com/rcore-os/buddy_system_allocator"
6
6
repository = " https://github.com/rcore-os/buddy_system_allocator"
7
7
keywords = [" allocator" , " no_std" , " heap" ]
8
- version = " 0.3.4 "
8
+ version = " 0.3.5 "
9
9
authors = [
" Jiajie Chen <[email protected] >" ]
10
10
edition = " 2018"
11
11
license = " MIT"
Original file line number Diff line number Diff line change @@ -77,8 +77,8 @@ impl Heap {
77
77
/// Add a range of memory [start, end) to the heap
78
78
pub unsafe fn add_to_heap ( & mut self , mut start : usize , mut end : usize ) {
79
79
// avoid unaligned access on some platforms
80
- start = ( start + size_of :: < usize > ( ) - 1 ) & ( !size_of :: < usize > ( ) ) ;
81
- end = end & ( !size_of :: < usize > ( ) ) ;
80
+ start = ( start + size_of :: < usize > ( ) - 1 ) & ( !size_of :: < usize > ( ) + 1 ) ;
81
+ end = end & ( !size_of :: < usize > ( ) + 1 ) ;
82
82
assert ! ( start <= end) ;
83
83
84
84
let mut total = 0 ;
@@ -273,7 +273,7 @@ use alloc::boxed::Box;
273
273
/// Create a locked heap:
274
274
/// ```
275
275
/// use buddy_system_allocator::*;
276
- /// let heap = LockedHeapWithRescue::new(& |heap: &mut Heap| {});
276
+ /// let heap = LockedHeapWithRescue::new(|heap: &mut Heap| {});
277
277
/// ```
278
278
///
279
279
/// Before oom, the allocator will try to call rescue function and try for one more time.
Original file line number Diff line number Diff line change @@ -77,7 +77,7 @@ fn test_heap_oom() {
77
77
#[ test]
78
78
fn test_heap_oom_rescue ( ) {
79
79
static mut SPACE : [ usize ; 100 ] = [ 0 ; 100 ] ;
80
- let heap = LockedHeapWithRescue :: new ( & |heap : & mut Heap | unsafe {
80
+ let heap = LockedHeapWithRescue :: new ( |heap : & mut Heap | unsafe {
81
81
heap. add_to_heap ( SPACE . as_ptr ( ) as usize , SPACE . as_ptr ( ) . add ( 100 ) as usize ) ;
82
82
} ) ;
83
83
You can’t perform that action at this time.
0 commit comments