File tree 2 files changed +8
-4
lines changed
2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
7
7
8
8
## [ Unreleased]
9
9
10
+ ### Fixed
11
+
12
+ - The heap size is ` end_addr ` - ` start_addr ` . Previously, it was wrongly
13
+ calculated as ` end_addr - start_addr - 1 ` .
14
+
10
15
## [ v0.2.0] - 2016-11-19
11
16
12
17
### Changed
Original file line number Diff line number Diff line change @@ -70,9 +70,8 @@ static HEAP: Mutex<Heap> = Mutex::new(Heap::empty());
70
70
/// - The heap grows "upwards", towards larger addresses. Thus `end_addr` must
71
71
/// be larger than `start_addr`
72
72
///
73
- /// - The size of the heap will actually be
74
- /// `(end_addr as usize) - (start_addr as usize) + 1` because the allocator
75
- /// won't use the byte at `end_addr`.
73
+ /// - The size of the heap is `(end_addr as usize) - (start_addr as usize)`. The
74
+ /// allocator won't use the byte at `end_addr`.
76
75
///
77
76
/// # Unsafety
78
77
///
@@ -83,7 +82,7 @@ static HEAP: Mutex<Heap> = Mutex::new(Heap::empty());
83
82
pub unsafe fn init ( start_addr : * mut usize , end_addr : * mut usize ) {
84
83
let start = start_addr as usize ;
85
84
let end = end_addr as usize ;
86
- let size = ( end - start) - 1 ;
85
+ let size = end - start;
87
86
HEAP . lock ( |heap| heap. init ( start, size) ) ;
88
87
}
89
88
You can’t perform that action at this time.
0 commit comments