• Ulan Degenbaev's avatar
    [heap] Instrument mark-compact to track retaining paths for debugging. · 40c34606
    Ulan Degenbaev authored
    This patch adds a new intrinsic: %DebugTrackRetainingPath(object).
    Calling the intrinsic in JS code saves a weak reference to the given
    object in GC internal table of tracked objects.
    
    Each subsequent full GC prints to stdout the retaining path for each
    tracked object (if it is still alive). The retaining path is the real
    path that the marker took from the root set to the tracked object.
    
    This is useful for investigating of memory leaks:
    1) Add %DebugTrackRetainingPath(leaking_object) in JS code.
    For example:
      function foo() {
        let x = { bar: "bar"};
        %DebugTrackRetainingPath(x);
        return () => { return x; }
      }
    
      let closure = foo();
      gc();
    
    2) Run d8 with --allow-natives-syntax --track-retaining-path --expose-gc.
    
    3) Check the retaining path in stdout.
    
    For more detailed inspection, run d8 in gdb and set breakpoint in
    
    v8: :internal::Heap::PrintRetainingPath.
    Change-Id: I01a0faac1e009bc6c321fa75613900b49d2b036f
    Reviewed-on: https://chromium-review.googlesource.com/575972
    Commit-Queue: Ulan Degenbaev <ulan@chromium.org>
    Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#46766}
    40c34606
Name
Last commit
Last update
..
runtime-array.cc Loading commit data...
runtime-atomics.cc Loading commit data...
runtime-classes.cc Loading commit data...
runtime-collections.cc Loading commit data...
runtime-compiler.cc Loading commit data...
runtime-date.cc Loading commit data...
runtime-debug.cc Loading commit data...
runtime-error.cc Loading commit data...
runtime-forin.cc Loading commit data...
runtime-function.cc Loading commit data...
runtime-futex.cc Loading commit data...
runtime-generator.cc Loading commit data...
runtime-internal.cc Loading commit data...
runtime-interpreter.cc Loading commit data...
runtime-intl.cc Loading commit data...
runtime-literals.cc Loading commit data...
runtime-liveedit.cc Loading commit data...
runtime-maths.cc Loading commit data...
runtime-module.cc Loading commit data...
runtime-numbers.cc Loading commit data...
runtime-object.cc Loading commit data...
runtime-operators.cc Loading commit data...
runtime-promise.cc Loading commit data...
runtime-proxy.cc Loading commit data...
runtime-regexp.cc Loading commit data...
runtime-scopes.cc Loading commit data...
runtime-strings.cc Loading commit data...
runtime-symbol.cc Loading commit data...
runtime-test.cc Loading commit data...
runtime-typedarray.cc Loading commit data...
runtime-utils.h Loading commit data...
runtime-wasm.cc Loading commit data...
runtime.cc Loading commit data...
runtime.h Loading commit data...