destroyInstance method

void destroyInstance(
  1. PooledInstanceProxy instance
)

Remove the instance from internal isolate dictionary and make it available for garbage collection

Implementation

void destroyInstance(PooledInstanceProxy instance) {
  var index = indexOfPi(instance);
  if (index == -1) {
    throw 'Cant find instance with id ${instance._instanceId} among active to destroy it';
  }

  _isolateSendPorts[index]!.send(_DestroyRequest(instance._instanceId));
  _pooledInstances.remove(instance._instanceId);
}