Crate jenga [] [src]

Jenga: A stack based allocator.

General principles:

There are two ways of making allocations:

a) by calling one of the place or place_iter methods, which then allow access to the data in the provided closure. b) by calling frame which allows access to the thread_local Frame, from which futher allocations can be made. This method might be slightly faster as no additional checks are nessesary.

Memory Pool

As a default size, 1MB of memory will be allocated whenever the allocator is used first. This can be changed by calling init_with_capacity first.

Structs

Cursor

'a: lifetime of the frame 'b: the borrow of &mut Frame

FArray

An array that owns the data.

FBox
Frame

An allocation Frame.

FramePlace
FramePlacer
InitError
OutOfMemory
Writer

'a: lifetime of the frame 'b: the borrow of &mut Frame

Functions

frame

lock the thread local data stack and run the closure with a reference to it calling any non-framed allocations will panic

init_with_capacity

reserve size bytes of memory for the allocator This will fail if it was already initialized

place

allocate count elements of T

place_iter

allocate count elements of T the iterator may not use the stack allocator.

place_raw

this function will run the provided closure with pointer to uninitialized memory. drop is not called afterwards.