Skip to content

Commit

Permalink
Update Allocator Designs post to use LinkedListAllocator::lock method
Browse files Browse the repository at this point in the history
  • Loading branch information
phil-opp committed Jan 30, 2020
1 parent 4f42826 commit 670ac60
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,7 @@ unsafe impl GlobalAlloc for Locked<LinkedListAllocator> {
unsafe fn alloc(&self, layout: Layout) -> *mut u8 {
// perform layout adjustments
let (size, align) = LinkedListAllocator::size_align(layout);
let mut allocator = self.inner.lock();
let mut allocator = self.lock();

if let Some((region, alloc_start)) = allocator.find_region(size, align) {
let alloc_end = alloc_start.checked_add(size).expect("overflow");
Expand All @@ -719,7 +719,7 @@ unsafe impl GlobalAlloc for Locked<LinkedListAllocator> {
// perform layout adjustments
let (size, _) = LinkedListAllocator::size_align(layout);

self.inner.lock().add_free_region(ptr as usize, size)
self.lock().add_free_region(ptr as usize, size)
}
}
```
Expand Down

0 comments on commit 670ac60

Please sign in to comment.