Use Chrome's Heap Snapshot feature to analyze memory usage over a period of time

Set breakpoints on lines 13 and 16 of the test code below. Run in debug mode, first the breakpoint is triggered at line 13:

 

Open Chrome Developer Tools, click the Profiles tab, then click the button "Take Snapshot":

 

Generate a Snapshot with ID 3:

 

Continue to execute the code in debug mode to line 16 and click the button "Take heap snapshot" to generate the second snapshot. Select "Objects allocated between Snapshot 3 and Snapshot 4" from the drop-down menu:

 

Use the variable name "arra" as a filter in the Summary below to find the variable arra with the highest memory usage between snapshot3 and snapshot4:

 

Hover over arra to see what this variable contains:

 
 

To get more original technical articles from Jerry, please follow the public account "Wang Zixi" or scan the QR code below:

 
 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326125334&siteId=291194637