free function

void free(
  1. Pointer<NativeType> pointer
)

Frees memory allocated by Win32-compatible allocators.

This function is allocator-agnostic and may safely free memory allocated with:

  • calloc
  • malloc
  • adaptiveCalloc
  • adaptiveMalloc
  • diagnosticCalloc
  • diagnosticMalloc

Passing a NULL pointer is a programming error.

Implementation

@pragma('vm:prefer-inline')
void free(Pointer pointer) {
  assert(pointer.isNotNull, "Pointer must not be a 'nullptr'.");
  adaptiveCalloc.free(pointer);
}