anchor.diff:            timeRunningCodeUs.difference(start.spawned).inMicroseconds,
         timeToFinishRunningCodeUs:
             timeFinishRunningCodeUs.difference(start.spawned).inMicroseconds,
  -      deltaRss: ProcessInfo.currentRss - start.rss));
  +      deltaHeap:
  +          await currentHeapUsage(start.wsUri, start.groupRefId) - start.rss));
  +}
  +
  +Future<int> currentHeapUsage(String wsUri, String groupRefId) async {
  +  final vm_service.VmService vmService =
  +      await vm_service_io.vmServiceConnectUri(wsUri);
  +  final vm_service.MemoryUsage usage =
  +      await vmService.getIsolateGroupMemoryUsage(groupRefId);
  +  vmService.dispose();
  +  return usage.heapUsage + usage.externalUsage;
   }
   
   Future<void> main() async {
  -  await SpawnLatencyAndMemory("IsolateSpawn.Dart2JS").report();
  -}
  +  final ServiceProtocolInfo info = await Service.controlWebServer(enable: true);
  +  final Uri observatoryUri = info.serverUri;
  +  final String wsUri =
  +      'ws://${observatoryUri.authority}${observatoryUri.path}ws';
  +  final vm_service.VmService vmService =
  +      await vm_service_io.vmServiceConnectUri(wsUri);
  +  final String mainGroupRefId = await getMainGroupRefId(vmService);
  +  vmService.dispose();
  +
  +  await SpawnLatencyAndMemory("IsolateSpawn.Dart2JS", wsUri, mainGroupRefId)
  +      .report();
  +}
  +
  +Future<String> getMainGroupRefId(vm_service.VmService vmService) async {
  +  final vm = await vmService.getVM();
  +  for (vm_service.IsolateGroupRef groupRef in vm.isolateGroups) {
  +    final vm_service.IsolateGroup group =
  +        await vmService.getIsolateGroup(groupRef.id);
  +    for (vm_service.IsolateRef isolateRef in group.isolates) {
  +      final isolateOrSentinel = await vmService.getIsolate(isolateRef.id);
  +      if (isolateOrSentinel is vm_service.Isolate) {
  +        final vm_service.Isolate isolate = isolateOrSentinel;
  +        if (isolate.name == 'main') {
  +          return groupRef.id;
  +        }
  +      }
  +    }
  +  }
  +  throw "Could not find main isolate";
  +}
  
positive.code:   }
  
    final String name;
    RawReceivePort receivePort;
  }
  
  
negative.code: // BSD-style license that can be found in the LICENSE file.
  
  import 'dart:async';
  import 'dart:developer';
  import 'dart:isolate';
  import 'dart:math';
  
  import 'package:meta/meta.dart';
  
  import 'package:compiler/src/dart2js.dart' as dart2js_main;
  import 'package:vm_service/vm_service.dart' as vm_service;
  import 'package:vm_service/vm_service_io.dart' as vm_service_io;
  
  class SpawnLatencyAndMemory {
    SpawnLatencyAndMemory(this.name, this.wsUri, this.groupRefId);
  
    Future<ResultMessageLatencyAndMemory> run() async {
      final completerResult = Completer();
  