MemoryGuard constructor

MemoryGuard(
  1. Pointer<NativeType> pointer,
  2. int size, {
  3. String debugName = 'Unnamed',
})

Constructs a MemoryGuard for the given pointer and size.

  • pointer: The pointer to guard.
  • size: The size of the memory block.
  • debugName: Optional name for debugging purposes.

Implementation

MemoryGuard(Pointer<NativeType> pointer, int size,
    {String debugName = 'Unnamed'})
    : _start = pointer.cast<Uint32>() + (-1),
      _end = pointer.cast<Uint32>() + (size ~/ sizeOf<Uint32>()),
      _debugName = debugName {
  _start.value = _guardValue;
  _end.value = _guardValue;
}