DevTools icon indicating copy to clipboard operation
DevTools copied to clipboard

When taking a heap snapshot, dump all string values to a file or view

Open zoherghadyali opened this issue 3 years ago • 1 comments

In apps where (string) objects take up a large portion of the heap, provide an option that allows developers to run additional queries over that data (such as regex) to find patterns for what kinds of strings contribute the most to memory footprint. Optionally, indicate how many strings are duplicates of each other.

Potential problems: Indexing the list of strings could require more memory from the tool.

zoherghadyali avatar Mar 07 '22 23:03 zoherghadyali

This kind of processing can be done in a separate program like the text editor of choice of the developer. DevTools could add a button to export all the strings to a file but I wonder if this is an overkill given that *.heapsnapshot files are basically *.json files that can already be opened by a text editor.

As of right now a developer could save a heapsnapshot file, open it in VSCode, find the keyword "strings" and scroll through the array of all the strings in the file. The bad thing about this approach is that "strings" also contains the names of nodes and edges.

By doing some pre-processing we could save a csv file of just the nodes of type string with their corresponding size.

joselea avatar Mar 15 '22 16:03 joselea