Re: Object Monitor

Chris <[email protected]> Sat, 10 Jun 2006 16:19:36 -0400
Newsgroups gmane.comp.web.dom.wdf
Message-ID <[email protected]>
Mandy, have a look at Firefox's Venkman or Microsoft's numerous JS 
debuggers, Visual Studio.Net being the most powerful (Express/Lite might 
do it as well, and they've a free JS debugger standalone, and old Visual 
Interdev copies can pull it off...). Any of those can keep a watch on 
the locals in scope, globals, watches you specify yourself, Running 
Documents to see what scripts are loaded, etc.

I don't think I've ever gotten a Stack Overflow in Javascript when it 
hasn't been due to too many levels of recursion.. basically the same 
func calling itself indefinitely, rarely anything more complex to unwind 
than that. A brutal fix for this is to find any func that is recursive, 
and set it to pass a counter parameter on each recursion. Set a limit on 
it - say 100, or higher if you need it, and an alert and throw:

if(iRecursions > 100) {
    alert('fn myFunction recursed over 100 times');
    throw 'myFunction recursing out of control';
}

You'll get a fail-fast error and find the problem recursing function (if 
you have many possibilities to consider) immediately.

HTH,
-Chris


Maninder, Singh wrote:
> Hi,
>
> Sometimes (and I don't know when) I get a Stack Overflow at line 0 error.
>
> I know that it could be due to -
>
> 1) Recursion
> 2) Lot of memory consumption by some object
> 3) Bad usage of iframes (I read it somewhere:)
> 4) Something else
>
> Since it's not reproducible everytime, it's hard to debug.
>
> So, I was wondering if there is a way to build something like an object monitor to keep track of what all objects are currently there in memory and what have been destroyed?
>
> Thoughts?
>
> Thank you,
> Mandy.
>
>
>
> Unsubscribe
> [email protected]
>
> List info
> http://www.quirksmode.org/dom/list.html 
> Yahoo! Groups Links
>
>
>
>  
>
>
>
>   



------------------------ Yahoo! Groups Sponsor --------------------~--> 
You can search right from your browser? It's easy and it's free.  See how.
http://us.click.yahoo.com/_7bhrC/NGxNAA/yQLSAA/9rHolB/TM
--------------------------------------------------------------------~-> 

Unsubscribe
[email protected]

List info
http://www.quirksmode.org/dom/list.html 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/wdf-dom/

<*> To unsubscribe from this group, send an email to:
    [email protected]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/