Git Product home page Git Product logo

Comments (7)

joyeecheung avatar joyeecheung commented on July 26, 2024 2

By the way I implemented MAT's algorithm on V8 heap snapshots in JavaScript: https://github.com/joyeecheung/v8-mat

The algorithm probably does not work on core dump (or heap snapshots converted from core dumps) yet because we don't have enough GC root information in the post-mortem metadata (I suppose it should be possible to expose GC Root indexes to the metadata though). The algorithm starts by iterating the GC roots in the heap and look at their dominated nodes.

from llnode.

hhellyer avatar hhellyer commented on July 26, 2024 1

I agree it's probably not possible to tell which objects are leaking from one dump.

Memory Analyzer for Java (http://www.eclipse.org/mat/) generates a dominator tree which shows you which references are keeping large chunks of the heap alive. For Java it's been an excellent technique for finding what's hanging on to object references and keeping large amounts of data alive. That often identifies the culprit in a leak situation from just one dump.

I think in both llnode and the v8 heap dumps we're missing the sort of detailed heap root information that we'd need to generate that though.

There's some background reading here:
https://help.eclipse.org/neon/index.jsp?topic=%2Forg.eclipse.mat.ui.help%2Fconcepts%2Fdominatortree.html
https://en.wikipedia.org/wiki/Dominator_(graph_theory)

from llnode.

bnoordhuis avatar bnoordhuis commented on July 26, 2024

When would an object be considered leaked? With a GC, an object is either reachable from the root set or it's garbage - there are no malloc-without-free leaks like you have in C.

from llnode.

indutny avatar indutny commented on July 26, 2024

It is pretty much impossible to figure out, I'm afraid. The only way it could work is by comparing two core dumps and seeing which objects are common to both of them. Would this work for your use-case @brendangregg ?

from llnode.

bnoordhuis avatar bnoordhuis commented on July 26, 2024

@hhellyer Heap snapshots let you calculate the retained size of an object; sum its object graph and keep track of cycles. Is that what you mean?

Aside: I remember discussing turning core dumps into heap snapshots (with you? not sure). That would cover that use case.

from llnode.

indutny avatar indutny commented on July 26, 2024

This has to be rewritten: https://github.com/indutny/core2dump

from llnode.

hhellyer avatar hhellyer commented on July 26, 2024

@bnoordhuis - I don't think the two are quite the same the dominator tree algorithm works out which object is responsible for keeping that retained space alive. Memory Analyzer shows retained size too but the dominator tree view shows how things are kept alive. (I'm going to struggle to explain it properly - it's definitely worth reading up on or trying out in Memory Analyzer.)

from llnode.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.