node.jsgoogle-chromememory-leaksdevtools

Meaning of "previous in system / Context" Chrome DevTools


I was inspecting the Memory Summary of a Heap Snapshot of my node.js application in Chrome DevTools and found a leaked object to be reachable via previous in system / Context @266607. Can anybody explain what that means, exactly? I understand what context means in this case, but for previous I could not find any documentation. To be clear, I mean this kind of graph:

I am talking about this type of inspector


Solution

  • A Context object has a previous field, referencing (i.e. pointing to) another Context object, which is the previous context of the current one (If you're really interested, here's its header file definition).

    As an example, the following is a screenshot I took of a Context object appearing in my own Summary view (I describe below how to get to this view):

    enter image description here

    In your image, the Context object with id @831295 has its previous field referencing the Context object with id @2801553:

    enter image description here

    You can see it for yourself by navigating to the view I screenshot above, as follows: