Are there any add-ons for Firefox that I can use to find out with part of the JavaScript causes memory leaks?
I've got nothing for firefox, but the webkit inspector in Chrome has a profiler built in that is great for that kind of thing.
As an added bonus it also shows you all browser events such as repaints, so you can engineer your code to have the least impact on the browser.
Use Drip.exe / IEleak, I used it a lot to search for memory leaks!
Other hits:
jQuery itself prevents a lot of memory leaks!
Test your code with http://jslint.com
There is a tool by Microsoft itself, but I don't know it is up to date: http://blogs.msdn.com/b/askie/archive/2008/12/31/javascript-memory-leak-detector-for-internet-explorer.aspx
There is also integration with Visual Studio: http://berniesumption.com/software/how-to-debug-javascript-in-internet-explorer/
There is a good article about mem leaks http://www.ibm.com/developerworks/web/library/wa-memleak/
http://www.debugbar.com/?langage=en
The best memory profiler I've found is for IE (supports even IE6 ;-). Give it a go - you will be surprised how good it is:
http://ajax.dynatrace.com/ajax/en/
Related
we have a single page application built with javascript, angular, etc.
noticed that in Chrome (only) the memory usage is rising until the tab crash with the "Aw snap" message.
seems like Chrome is not running the garbage collector when it should.
after some research with old Chrome versions i've found that in version 61 everything works very good and the memory usage is very minimal, but in v62 and onward (including canary v66) the GC is not collecting, resulting in memory usage up to few giga. until it crash.
once i open the devtools the GC is collecting as it should and memory usage is normal again.
any idea what is happening?
Chrome developer here. It's hard to guess what might be going on. Please file a bug at crbug.com/new, include repro instructions, and post the bug number here.
Anyone know of a good javascript performance tool? I have a javascript heavy page that runs fine in chrome but is very slow in IE.
I'd like to poke around and see what portions of my javascript may be slowing it down.
Dynatrace AJAX Edition is what you want, though it might take a little while to get used to it.
Dynatrace have some good video tutorials / talks online.
http://ajax.dynatrace.com/ajax/en/
It's free too
I know that IE9 has a script profiler built-in to the dev tools (press F12 to access). I know IE8 has the same tools, but unsure if it has the profiler. If it doesn't have the profiler, you could always use IE9 placed into IE8 browser mode
So tried my hand at profiling some code and I figured the easiest way to do it (at least on Firefox) was to use either console's time/timeEnd or profile/profileEnd, and I tried both.
The problem I have is with the number of runs I can do before Firefox crashes on me. Now I won't paste the code here because it's typical benchmarking code (and it's very messy), but obviously the gist of it is that it runs functions (a test is represented with a function), logging their execution time for a certain number of runs.
Now with for example, 5e4 it sorta works but I don't think it's enough to spot (very) micro optimizations, but more than that, it crashes.
So how do you profile your JavaScript? Because this way, it's barely feasible.
When I used to profile my JavaScript code I used Chrome's profiler; the JavaScript Console in the developer view gives it, and it pretty much worked for me. Have you ever tried it?
I have tried profiling a page with a lot of scripting in Firebug on FF4 and the same in Chrome (last version). Firefox crashed within a second or two, Chrome didn't seem to have problems with it. Maybe you can find something on it in the Firebug issues list?
Although not a traditional code profiler, I recommend Google's Speed Tracer:
Using Speed Tracer you are able to get a better picture of where time is being spent in your application. This includes problems caused by JavaScript parsing and execution, layout, CSS style recalculation and selector matching, DOM event handling, network resource loading, timer fires, XMLHttpRequest callbacks, painting, and more.
I think the profiler in the JavaScript Debugger (aka Venkman) is quite good. The version currently on addons.mozilla.org is not compatible with Firefox 4, but the change necessary to make it work has been committed. See https://bugzilla.mozilla.org/show_bug.cgi?id=614557 for details.
dynaTrace AJAX edition(free)- one more tool in your bag. Offers a little bit more detailed performance metrics, IMHO. They used to have it only for IE, but their new one supports FF too. Also see Steve Sounder's blog
Please tell me how to find out the memory leak in browser and what is the best way to solve the problem. Is there any guideline for writing javascript to avoid memory leak?
And also if you can tell me some problem which you experienced related to memory leak and how did you debug and find out the solution would provide a great understanding to me.
Thanks
Look at this IBM article on Memory leak patterns in JavaScript
For Internet Explorer you can try sIEve or the JavaScript Memory Leak Detector from Microsoft (The link to the documentation seems to be broken). In Firefox there is the Leak Monitor Add-on. There is also a list of tools for Firefox here.
UPDATE:
There is a new version of the Microsoft memory leak detector at the link below.
Link
I am looking for an IE 6 / 7 plug-in or something like Firebug_Lite thing that can show the memory usage in runtime, as well as the allocation of memory of each object or variable. Anyone know what tool has this functionality? Thanks.
You could try Drip for memory leaks but in my experience that's pretty much it for IE. Let's wait for better responses :)
Well. i found out there is a tool called Javascript Memory Validator. BUt it is expensive and seems like only work for Firefox. And it is hard to use.
Still looking for a good IE tool for checking the javascript performance & memory allocation.