Struct drone_core::heap::Pool [] [src]

pub struct Pool { /* fields omitted */ }

A lock-free fixed-size blocks allocator.

The Pool allows lock-free O(1) allocations, deallocations, and initialization.

A Pool consists of capacity number of fixed-size blocks. It maintains a free list of deallocated blocks.

Methods

impl Pool
[src]

[src]

Creates an empty Pool.

The returned pool needs to be further initialized with init method. Resulting location of the pool should be the sum of offset argument provided to the current method and start argument for init method.

[src]

Initializes the pool with start address.

This operation should compute in O(1) time.

Safety

  • Must be called no more than once.
  • Must be called before using the pool.

[src]

Returns the pool size.

[src]

Allocates a fixed-size block of memory. Returns None if the pool is exhausted.

This operation should compute in O(1) time.

[src]

Deallocates a fixed-size block of memory referenced by ptr.

This operation should compute in O(1) time.

Safety

ptr should not be used after deallocation.