Ah, your infinite loop is really infinite recursion. This is different. Rhino's instruction count is per stack frame. Each time a new stack is created, the instruction count starts over. You need to look at setting the maximum interpreter stack depth on the contexts. See the call:
Context.setMaximumInterpreterStackDepth() Kevin -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: Wednesday, April 16, 2008 2:29 PM To: [email protected] Subject: Re: how to avoid infinite loop I just added some debugging script to figure out how many times Firefox and IE execute the statements before they exit out of the infinite loop. IE displayed a message - "Stack overflow" and exited after 2555 invocations. FireFox - exited after 1000 invocations . I think the logic to detect infinite loop is part of their ScriptEngine right. Otherwise, how did both of the browsers exit after a low number of invocations? If I put code to limit the number of lines that are interpreted, it still results in High CPU and Memory usage. Any suggestions? I have pasted my debug code below: <html> <head> <script> var count = 0; </script> </head> <body> <a href='http://google.com' id='a1'>Google</a><br> <script> var RealWinOpen = null; function SymOnLoad() { if(RealWinOpen != null) { count++; RealWinOpen(); } } RealWinOpen = SymOnLoad; RealWinOpen(); </script> <script> document.write("Count value is : " + count); </script> </body> </html> _______________________________________________ dev-tech-js-engine-rhino mailing list [email protected] https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino _______________________________________________ dev-tech-js-engine-rhino mailing list [email protected] https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino
