Arena class

An Allocator which frees all allocations at the same time.

The arena allows you to allocate heap memory, but ignores calls to free. Instead you call releaseAll to release all the allocations at the same time.

Also allows other resources to be associated with the arena, through the using method, to have a release function called for them when the arena is released.

An Allocator can be provided to do the actual allocation and freeing. Defaults to using calloc.

Implemented types
Available Extensions


Arena([Allocator allocator = calloc])
Creates a arena of allocations.


hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited


allocate<T extends NativeType>(int byteCount, {int? alignment}) Pointer<T>
Allocates memory and includes it in the arena.
free(Pointer<NativeType> pointer) → void
Does nothing, invoke releaseAll instead.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
onReleaseAll(void releaseResourceCallback()) → void
Registers releaseResourceCallback to be executed on releaseAll.
releaseAll({bool reuse = false}) → void
Releases all resources that this Arena manages.
toString() String
A string representation of this object.
using<T>(T resource, void releaseCallback(T)) → T
Registers resource in this arena.


operator ==(Object other) bool
The equality operator.