2

We're developing a javascript application that has been working correctly so far. However, recently, the application started to crash from time to time - most significantly on safari, but it also happens in other browsers such as Chrome. Is there any general way on how to debug such web applications that are javascript-heavy? Or do you have any suggestions where to start?

Thanks

leopik
  • 2,323
  • 2
  • 17
  • 29
  • 4
    Use [Firebug](https://addons.mozilla.org/en-US/firefox/addon/firebug/) or the Chrome debugger – vogomatix May 07 '14 at 13:43
  • Because the problem is intermittent I'd seriously consider logging client-side javascript errors to the server if you are not already doing so. (http://stackoverflow.com/questions/119432/logging-clientside-javascript-errors-on-server) – David Tansey May 07 '14 at 13:52
  • have you done error handling in your java script application? – Hitesh Oct 24 '14 at 05:15
  • What kind of error-handling are you talking about? ... There are no errors in the console when the app is running, if that's what you mean. – leopik Oct 24 '14 at 07:06

2 Answers2

0

Checkout the Chrome dev tools profiling tools: https://developers.google.com/chrome-developer-tools/docs/timeline

That can help to expose when you may be running out of memory.

Jonathan.Brink
  • 23,757
  • 20
  • 73
  • 115
  • Yeah, that helped a lot actually. I discovered that too many listeners are being attached (and the amount grows linearly with time). Do you know how to find out where exactly they are being attached? To which DOM elements? – leopik May 08 '14 at 08:17
  • Glad that helped. I've not gone down the path of determining how many listeners are attached to a particular domNode, but this SO post would probably help: http://stackoverflow.com/questions/446892/how-to-find-event-listeners-on-a-dom-node – Jonathan.Brink May 08 '14 at 12:09
-1

You can optimize general perf of the language by checking jsPerf snippets. (you can also add test or use the library benchmarkJs.

This stackoverflow question might help as well.

Community
  • 1
  • 1
isThisLove
  • 269
  • 2
  • 4