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

Constructors

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

Properties

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

Methods

allocate<T extends NativeType>(int byteCount, {int? alignment}) Pointer<T>
Allocates memory and includes it in the arena.
override
call<T extends SizedNativeType>([int count = 1]) Pointer<T>

Available on Allocator, provided by the AllocatorAlloc extension

Allocates sizeOf<T>() * count bytes of memory using allocate.
free(Pointer<NativeType> pointer) → void
Does nothing, invoke releaseAll instead.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
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.
inherited
using<T>(T resource, void releaseCallback(T)) → T
Registers resource in this arena.

Operators

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