getRetainingPath method

Future<RetainingPath> getRetainingPath(
  1. String isolateId,
  2. String targetId,
  3. int limit, {
  4. String? idZoneId,
})

The getRetainingPath RPC is used to lookup a path from an object specified by targetId to a GC root (i.e., the object which is preventing this object from being garbage collected).

If isolateId refers to an isolate which has exited, then the Collected Sentinel is returned.

If targetId refers to a heap object which has been collected by the VM's garbage collector, then the Collected Sentinel is returned.

If targetId refers to a non-heap object which has been deleted, then the Collected Sentinel is returned.

If the object handle has not expired and the object has not been collected, then an RetainingPath will be returned.

The limit parameter specifies the maximum path length to be reported as part of the retaining path. If a path is longer than limit, it will be truncated at the root end of the path.

If idZoneId is provided, temporary IDs for InstancesRef and Instances in the RPC response will be allocated in the specified ID zone. If idZoneId is omitted, ID allocations will be performed in the default ID zone for the isolate. See IDs and Names for more information about ID zones.

See RetainingPath.

This method will throw a SentinelException in the case a Sentinel is returned.

Implementation

Future<RetainingPath> getRetainingPath(
  String isolateId,
  String targetId,
  int limit, {
  String? idZoneId,
}) =>
    _call('getRetainingPath', {
      'isolateId': isolateId,
      'targetId': targetId,
      'limit': limit,
      if (idZoneId != null) 'idZoneId': idZoneId,
    });