File tree Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Expand file tree Collapse file tree 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/).
77
88## [ Unreleased]
99
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+
1015## [ v0.2.0] - 2016-11-19
1116
1217### Changed
Original file line number Diff line number Diff line change @@ -70,9 +70,8 @@ static HEAP: Mutex<Heap> = Mutex::new(Heap::empty());
7070/// - The heap grows "upwards", towards larger addresses. Thus `end_addr` must
7171/// be larger than `start_addr`
7272///
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`.
7675///
7776/// # Unsafety
7877///
@@ -83,7 +82,7 @@ static HEAP: Mutex<Heap> = Mutex::new(Heap::empty());
8382pub unsafe fn init ( start_addr : * mut usize , end_addr : * mut usize ) {
8483 let start = start_addr as usize ;
8584 let end = end_addr as usize ;
86- let size = ( end - start) - 1 ;
85+ let size = end - start;
8786 HEAP . lock ( |heap| heap. init ( start, size) ) ;
8887}
8988
You can’t perform that action at this time.
0 commit comments