malloc<T extends NativeType> function

Pointer<T> malloc<T extends NativeType>(
  1. int numBytes
)

Allocates bytes on the module heap. Release the result with free.

Implementation

Pointer<T> malloc<T extends NativeType>(int numBytes) {
  final ptr = _lib._malloc<T>(numBytes);
  if (ptr != nullptr) _heapAllocations.add(ptr);
  return ptr;
}