Trait comet::allocator::Allocator[][src]

pub trait Allocator {
    fn line_bitmap(&self) -> &SpaceBitmap<LINE_SIZE>;
fn get_all_blocks(&mut self, list: &mut BlockList);
fn take_current_block(&mut self) -> Option<BlockTuple>;
fn put_current_block(&mut self, block_tuple: BlockTuple);
fn get_new_block(&mut self) -> Option<BlockTuple>;
fn handle_no_hole(&mut self, size: usize) -> Option<BlockTuple>;
fn handle_full_block(&mut self, block: *mut Block); fn allocate(&mut self, size: usize) -> Option<*mut HeapObjectHeader> { ... }
fn scan_for_hole(
        &mut self,
        size: usize,
        block_tuple: BlockTuple
    ) -> Option<BlockTuple> { ... }
fn allocate_from_block(
        &self,
        size: usize,
        block_tuple: BlockTuple
    ) -> (BlockTuple, *mut HeapObjectHeader) { ... } }
Expand description

Trait for the allocators in the immix space.

Only use get_all_blocks() and allocate() from outside.

Required methods

Get all block managed by the allocator, draining any local collections.

Get the current block to allocate from.

Set the current block to allocate from.

Get a new block from a block resource.

Callback if no hole of size bytes was found in the current block.

Callback if the given block has no holes left.

Provided methods

Allocate an object of size bytes or return None.

This allocation will be aligned (see HeapObjectHeader.get_size()). This object is not initialized, just the memory chunk is allocated.

This will try to find a hole in the take_current_block(). If there Is no hole handle_no_hole() will be called. If this function returns None a ‘get_new_block()’ is requested.

Scan a block tuple for a hole of size bytes and return a matching hole.

If no hole was found handle_full_block() is called and None returned.

Allocate an uninitialized object of size bytes from the block tuple.

Returns the block tuple with a modified low offset and the allocated object pointer.

Note: This must only be called if there is a hole of size bytes starting at low offset!

Implementors