allocate<T extends NativeType> method

  1. @override
Pointer<T> allocate<T extends NativeType>(
  1. int byteCount,
  2. {int? alignment}
)
override

Allocates memory and includes it in the arena.

Uses the allocator provided to the Arena constructor to do the allocation.

Throws an ArgumentError if the number of bytes or alignment cannot be satisfied.

Implementation

@override
Pointer<T> allocate<T extends NativeType>(int byteCount, {int? alignment}) {
  _ensureInUse();
  final p = _wrappedAllocator.allocate<T>(byteCount, alignment: alignment);
  _managedMemoryPointers.add(p);
  return p;
}