Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
143
rated 0 times [  145] [ 2]  / answers: 1 / hits: 26656  / 15 Years ago, tue, january 26, 2010, 12:00:00

Possible Duplicate:

What is the best way to profile javascript execution?






I have a few scripts that use jQuery, and I think I have a memory leak in one of them.



How one could profile and find what parts of the scripts that I have are using the most memory/CPU?


More From » performance

 Answers
39

Regarding memory consumption



Memory leaks in JavaScript are usually ignored except when they turn into browser memory leaks (that is, even after the user navigates away from the page, the memory continues allocated and there's no way to free it). The reason for this is that while your web application may have some memory leaks, users will go from one page into another so the leaks are minimized. However they may not restart the browser, so browser memory leaks may be serious. Some JavaScript code is known to cause memory leaks on certain browsers, being Internet Explorer probably the worst in this area. For it you may find Microsoft JavaScript Memory Leak Detector to be very useful.



Regarding times



IE, Chrome and Safari have built in profilers in the web development tools that ship with the browser. For Firefox you may use Firebug. Also useful may be, since you're using jQuery which means your profiling report will be filled with anonymous functions and alike, making it quite unreadable, John Resig's jQuery profiling plugin, which will give you a clearer output on the matter.


[#97744] Friday, January 22, 2010, 15 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
gilbertomaximilianod

Total Points: 208
Total Questions: 96
Total Answers: 111

Location: Northern Mariana Islands
Member since Wed, Feb 24, 2021
3 Years ago
;