releaseAll method Null safety

void releaseAll(
  1. {bool reuse = false}

Releases all resources that this Arena manages.

If reuse is true, the arena can be used again after resources have been released. If not, the default, then the allocate and using methods must not be called after a call to releaseAll.

If any of the callbacks throw, releaseAll is interrupted, and should be started again.


void releaseAll({bool reuse = false}) {
  if (!reuse) {
    _inUse = false;
  // The code below is deliberately wirtten to allow allocations to happen
  // during `releaseAll(reuse:true)`. The arena will still be guaranteed
  // empty when the `releaseAll` call returns.
  while (_managedResourceReleaseCallbacks.isNotEmpty) {
  for (final p in _managedMemoryPointers) {;