forceGC method

Future<void> forceGC ()

Force a garbage collection run in the VM.

Implementation

Future<void> forceGC() async {
  try {
    await _peer
        .sendRequest(_collectAllGarbageMethodName, <String, String>{
          'isolateId': 'isolates/${_appIsolate.numberAsString}',
        });
  } catch (error, stackTrace) {
    throw DriverError(
      'Failed to force a GC due to remote error',
      error,
      stackTrace,
    );
  }
}