What tools and techniques do you use to fix browse

2020-02-25 23:03发布

I am trying to fix memory leaks in IE 7. Using Drip for investigations but it is not helping much when most dynamically generated DOM elements do not have unique ids.

Tips?

3条回答
ゆ 、 Hurt°
2楼-- · 2020-02-25 23:04

Well, Your best bet is to understand what causes them, so you can look critically at your code, identify patterns that may cause a leak, and then avoid or refactor around them.

Here's a couple of links to get you started, both very informative:

查看更多
男人必须洒脱
3楼-- · 2020-02-25 23:08

You should try the Javascript Memory Leak detector developed internally at Microsoft.

查看更多
Viruses.
4楼-- · 2020-02-25 23:26

Just remember that memory leaks are really about you not cleaning up after yourself. All you need is a little organization.

In the past, I have created my own proxy object for attaching events to DOM elements. It uses my javascript library's api to actually set and remove events. The proxy itself just keeps track of all of the references so that I can call a method on it to have it clean up all of my potential memory leaks.

For my purposes, I was able to just call a single deconstructor on the page that would clean up the leaks for the entire page when the user was leaving the page.

You may have to be more granular but the technique is the same.

查看更多
登录 后发表回答