debugging - How do I Debug Memory Leaks, Infinite Loops, and Executing Javascript in the Browser? -
what recommended ways check infinite loops in javascript in browser? open chrome , crashes, there way breakpoint or somehow pinpoint occurred?
then i'm wondering, how see running list of executing scripts in browser (say timer lost track of running , it's slowing things down)? preferably in chrome/safari, firefox work too.
i use element inspector/console time, haven't figured out ways debug these 3 things.
thanks!
for script crashes browser, can insert breakpoint anywhere in code before crashes. manually step through code until crashes. if unable insert breakpoint before browser crashes, can add "debugger;" statement somewhere in code. inserts breakpoint @ point in code.
one way see what's being run js profile it. dev tools come profiler. profile code few seconds after page loads, , give glimpse of what's still running. if using library such jquery, see lot of internal jquery functions , of own. @ function takes running time (per call) , try minimize usage, costly.
if have infinite loop in "non-threaded" js, page wouldn't load @ all. firefox should tell script taking long time load , let debug (which show is). "threaded" js (ones that's run callback or settimeout), track them profiler.
Comments
Post a Comment