简体   繁体   中英

Identifying memory leak outside of Javascript heap

I'm debugging a memory leak in a complex Javascript application (hundreds of files and nearly a million lines of code). It is a game, so it has heavy use of PNG graphics and the 2d canvas as well.

When memory profiling with Chrome's dev tools, I don't see much change in the heap allocation, yet the memory usage in Chrome's task manager continues to rise. In fact, the GPU memory plus the JS memory only total about half of the total memory. How can I go about debugging where the rest of this memory is going?

In very many cases a leak in the native memory has a leaked object in js memory. So with a very high probability after fixing all the js leaks in your app you will have no leaks in the native memory.

See the answer Tool to track down JavaScript memory leak

The dom nodes occupy native memory directly hence higher the dom nodes higher the native memory consumption. Also since you mentioned there are lot of graphics involved you need to take into account that an image rendered in an <img> tag takes up additional native memory and it is usually more than its original image size.

Since its been a year you asked this question if you have probably solved your issue you can write your solutions for others here.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM