Arena<T extends NativeType> class
Instead of doing many little allocations, Arena allocates a large chunk of memory which can be sliced into multiple ArrayViews. This can significantly improve performance and it makes memory management simpler.
final arena = Uint8Arena.allocate(10);
final array = arena.newArray(5);
final array2 = arena.newArray(5);
void some_native_c_api(array.ptr, array.view.length, array2.ptr, array2.view.length);
arena.delete();
- Available Extensions
Constructors
Properties
-
buffer
→ Pointer<
T> -
Pointer to allocated buffer
@protected, final
- freeSpace → int
-
Left free space of Arena.
read-only
- hashCode → int
-
The hash code for this object. [...]
read-only, inherited
- length → int
-
Total length of allocated memory
final
- runtimeType → Type
-
A representation of the runtime type of the object.
read-only, inherited
Methods
-
delete(
) → void - Deletes all allocated memory.
-
newArray(
int length ) → ArrayView< T> -
Returns a slice of
length
elements from the pre-allocated array of Arena. Whenlength
exceeds freeSpace it throws a RangeError.@mustCallSuper -
noSuchMethod(
Invocation invocation ) → dynamic -
Invoked when a non-existent method or property is accessed. [...]
inherited
-
toString(
) → String -
Returns a string representation of this object.
inherited
Operators
-
operator ==(
Object other ) → bool -
The equality operator. [...]
inherited