HeapSnapshotGraph.fromChunks constructor
Populates the HeapSnapshotGraph by parsing the events from the
HeapSnapshot stream.
Set flags to false to save processing time and memory footprint by skipping decoding or calculation of certain data:
- calculateReferrersfor HeapSnapshotObject.referrers
- decodeObjectDatafor HeapSnapshotObject.data
- decodeExternalPropertiesfor HeapSnapshotGraph.externalProperties
- decodeIdentityHashCodesfor HeapSnapshotObject.identityHashCode
Implementation
HeapSnapshotGraph.fromChunks(
  List<ByteData> chunks, {
  bool calculateReferrers = true,
  bool decodeObjectData = true,
  bool decodeExternalProperties = true,
  bool decodeIdentityHashCodes = true,
}) {
  final reader = ReadStream(chunks);
  // Skip magic header
  for (int i = 0; i < _magicHeader.length; ++i) {
    reader.readByte();
  }
  _flags = reader.readInteger();
  _name = reader.readUtf8();
  _shallowSize = reader.readInteger();
  _capacity = reader.readInteger();
  _externalSize = reader.readInteger();
  _readClasses(reader);
  _readObjects(reader, decodeObjectData: decodeObjectData);
  if (decodeExternalProperties || decodeIdentityHashCodes) {
    _readExternalProperties(
      reader,
      decodeExternalProperties: decodeExternalProperties,
    );
  }
  if (decodeIdentityHashCodes) {
    _readIdentityHashCodes(reader);
  }
  if (calculateReferrers) _calculateReferrers();
}