Skip to main content

fdf_arena_t

Type Alias fdf_arena_t 

Source
pub type fdf_arena_t = fdf_arena;
Expand description

An arena which supports allocation of memory.

The arena owns all the allocated memory. Individual memory allocations can be freed by calling |fdf_arena_free|, or will be freed when all references to the underlying runtime arena object are destroyed.

|fdf_arena_create| will return a reference to a newly created runtime arena object. Passing an arena to |fdf_channel_write| will create and transfer a new reference to that same arena, and does not take ownership of your arena reference. The reference may be destroyed using |fdf_arena_drop_ref|.

§Thread safety

Operations on arena objects are thread-safe.

§Example

fdf_arena_t* arena; zx_status_t status = fdf_arena_create(0, ‘exam’, 0, &arena);

// Allocate new blocks of memory. void* addr1 = fdf_arena_allocate(arena, 0x1000); void* addr2 = fdf_arena_allocate(arena, 0x2000);

// Use the allocated memory…

fdf_arena_drop_ref(arena);

Aliased Type§

pub struct fdf_arena_t { /* private fields */ }