diff --git a/mem_arena/src/lib.rs b/mem_arena/src/lib.rs index 15bae99..2e0e329 100644 --- a/mem_arena/src/lib.rs +++ b/mem_arena/src/lib.rs @@ -19,7 +19,7 @@ fn alignment_offset(addr: usize, alignment: usize) -> usize { /// Additionally, to minimize unused space in blocks, allocations above a specified /// size (the large allocation threshold) are given their own block. /// -/// The block size and large allocation threshold size are configurable. +/// The block size and large allocation threshold are configurable. #[derive(Debug)] pub struct MemArena { blocks: RefCell>>, @@ -28,7 +28,7 @@ pub struct MemArena { } impl MemArena { - /// Create a new arena, with default block size and large allocation threshold + /// Create a new arena, with default block size and large allocation threshold. pub fn new() -> MemArena { MemArena { blocks: RefCell::new(vec![Vec::with_capacity(DEFAULT_BLOCK_SIZE)]), @@ -37,6 +37,7 @@ impl MemArena { } } + /// Create a new arena, with a custom block size and large allocation threshold. pub fn new_with_settings(block_size: usize, large_alloc_threshold: usize) -> MemArena { assert!(large_alloc_threshold <= block_size); @@ -127,7 +128,6 @@ impl MemArena { let mut blocks = self.blocks.borrow_mut(); - // If it's a zero-size allocation, just point to the beginning of the curent block. if size == 0 { return blocks.first_mut().unwrap().as_mut_ptr();