开发者

How to check and test how much memory a javascript app is leaking [closed]

开发者 https://www.devze.com 2023-02-04 10:39 出处:网络
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.

Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.

Closed 9 years ago.

Improve this question

开发者_如何学Goiam looking for some tools or ways to detect memory leaks, slow methods in my javascript app.


You need to use the profiler; I recommend Chrome's. In the profiler the steps are

  1. Go to the profile part of the developer tools
  2. Get to the part where the slow js is
  3. Start recording
  4. Start the suspect code
  5. Stop recording

After that, the profiler will tell you everything you want to know about how many objects there are, how much time is spent in each method, etc...

The procedure should be similar with Firebug on Firefox.


Good question. Profilers/browser plugins are handy, but very well may yield results unique to the browser being tested on. There are a number of techniques available from testing via multiple browser's plugins/profilers to inline debugging performance statements.

Two good articles with, robust examples and recommendations:

  1. How do you performance test JavaScript code?
  2. Memory leak patterns in JavaScript
0

精彩评论

暂无评论...
验证码 换一张
取 消