Memory leak is an important problem in JavaScript/NodeJS, though they have Garbage collection mechanism. Now there are some tools are provided to detect memory leak for JavaScript/NodeJS, such as Chrome Devtools, Webstorm and so on. These tools solve our problems in some extent. However, there are also some problems left, such as not smart enough to recommend suspected objects.
Compared to above, JS Memory Analysor provides more convenient functionality to help us find memory leak objects more quickly. To retained the habits of JS developers and reduce the learning cost, JS Memory Analysor is developed base on Chrome Devtools.
It is easy to use JS Memory Analysor. Just with the steps as follows:
git clone [current repo] [project path]
cd [project path]
npm install && npm run start
open the Chrome with http://localhost:9999
After open the browser, you should load multiple local files(.heapsnapshot) simultaneously. These heap snapshots are dumped duration the operation of the application.
( PS: Please use chrome to open above link. )
Compared to native Chrome Devtools,there are several advantages as follows:
- Intelligent summary. It will generate summary according to multi-snapshots' memory trends and changes of objects just as shown in the following picture.
- Recommend suspected memory leaks. JS Memory Analysor provides the objects that are more likely to exist memory leaks in different scenes in order to help users to locate problems more quickly. As shown in the picture, there are three kinds of recommendations are displayed.
- Highlight and show more complete information. Highlight can help users focus on important objects more quickly and the later help trace problem more conveniently.
- Add a view to display object list. It is useful for us to search a object or do some operations such as sorting to find objects that we are intersted in. The added attribute of SOCount(Similar Object Count) help us find objects that are similary which base on multi-attributes, such as Distance, Class, Shallow Size, Retained Size and so on.
Related terms of memory leaks can refer to https://developers.google.com/web/tools/chrome-devtools
- Collect js memory leak cases
- Provide more flexible interactions
- Optimize recommendation algorithm