Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Allocation profiler - memory heap allocation analysis #73

@paulirish

Description

@paulirish

watch this:

![image](https://cloud.githubusercontent.com/assets/39191/5909643/562aff8c-a567-11e4-92b6-198a2dd22be9.png) ## Instructions to use heap allocation profiler 1. open devtools profiler 2. do a warm-up action 3. start allocation profiler 4. repeat action a few times 5. if the action has a leak you will see the same number of groups of blue bars in the overview pane 6. stop the profiler 7. select one group of these blue bars in the overview 8. look into the list of objects

The allocation profiler takes heap snapshots periodically throughout the recording (as frequently as every 50 ms!) and one final snapshot at the end of the recording.

image

The bars at the top indicate when new objects are found in the heap. The height of each bar corresponds to the size of the recently allocated objects, and the color of the bars indicate whether or not those objects are still live in the final heap snapshot: blue bars indicate objects that are still live at the end of the timeline, gray bars indicate objects that were allocated during the timeline, but have since been garbage collected.

In the example above, an action was performed 10 times. The sample program caches five objects, so the last five blue bars are expected. But the leftmost blue bar indicates a potential problem. You can then use the sliders in the timeline above to zoom in on that particular snapshot and see the objects that were recently allocated at that point. Clicking on a specific object in the heap will show its retaining tree in the bottom portion of the heap snapshot. Examining the retaining path to the object should give you enough information to understand why the object was not collected, and you can make the necessary code changes to remove the unnecessary reference.

Record heap allocation timeline

image

See allocated memory by function

image

references

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions