<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
 
    <title>JavaScript Rules - error</title>
    <link href="http://javascriptrules.com/tag/error.xml" rel="self"/>
    <link href="http://javascriptrules.com"/>
    <updated>2012-03-08T18:28:28-08:00</updated>
    <id>http://javascriptrules.com/tag/error</id>
    <author>
        <name>Marcel Duran</name>
        <email>marcelduran@gmail.com</email>
    </author>
 
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    <entry>
        <title>Limitation on call stacks</title>
        <link href="http://javascriptrules.com/2009/06/30/limitation-on-call-stacks"/>
        <updated>2009-06-30T00:00:00-07:00</updated>
        <id>/2009/06/30/limitation-on-call-stacks</id>
        <content type="html">&lt;p&gt;Fellow Yahoo! &lt;a href='http://www.nczonline.net/about/'&gt;Nicholas Zakas&lt;/a&gt; has blogged about some browsers limitations and recently ran some tests in order to check &lt;a href='http://www.nczonline.net/blog/2009/05/19/javascript-stack-overflow-error/'&gt;browsers call stack sizes&lt;/a&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Not surprisingly, different browsers have different call stack sizes. Also not surprisingly, the method that they use to determine the call stack varies as well. The various call stack sizes I could measure are (give or take, might be off by 1 or 2):&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Internet Explorer 7: 1,789&lt;/p&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;p&gt;Firefox 3: 3,000&lt;/p&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;p&gt;Chrome 1: 21,837&lt;/p&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;p&gt;Opera 9.62: 10,000&lt;/p&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;p&gt;Safari 3.2: 500 In each case, the browser will end up stopping your code and (hopefully) display a message about the issue:&lt;/p&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;p&gt;Internet Explorer 7: &amp;#8220;Stack overflow at line x&amp;#8221;&lt;/p&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;p&gt;Firefox 3: &amp;#8220;Too much recursion&amp;#8221;&lt;/p&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;p&gt;Chrome 1: n/a&lt;/p&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;p&gt;Opera 9.62: &amp;#8220;Abort (control stack overflow)&amp;#8221;&lt;/p&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;p&gt;Safari 3.2: &amp;#8220;RangeError: Maximum call stack size exceeded.&amp;#8221;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;

&lt;p&gt;We ran some tests ourselves in order to get the call stack sizes on other browsers/hosts/OSs using this simple code:&lt;/p&gt;
&lt;div class='highlight'&gt;&lt;pre&gt;&lt;code class='js'&gt;&lt;span class='kd'&gt;var&lt;/span&gt; &lt;span class='nx'&gt;i&lt;/span&gt; &lt;span class='o'&gt;=&lt;/span&gt; &lt;span class='mi'&gt;0&lt;/span&gt;&lt;span class='p'&gt;;&lt;/span&gt;
 
&lt;span class='kd'&gt;function&lt;/span&gt; &lt;span class='nx'&gt;recurse&lt;/span&gt; &lt;span class='p'&gt;()&lt;/span&gt; &lt;span class='p'&gt;{&lt;/span&gt;
    &lt;span class='nx'&gt;i&lt;/span&gt;&lt;span class='o'&gt;++&lt;/span&gt;&lt;span class='p'&gt;;&lt;/span&gt;
    &lt;span class='nx'&gt;recurse&lt;/span&gt;&lt;span class='p'&gt;();&lt;/span&gt;
&lt;span class='p'&gt;}&lt;/span&gt;
 
&lt;span class='k'&gt;try&lt;/span&gt; &lt;span class='p'&gt;{&lt;/span&gt;
    &lt;span class='nx'&gt;recurse&lt;/span&gt;&lt;span class='p'&gt;();&lt;/span&gt;
&lt;span class='p'&gt;}&lt;/span&gt; &lt;span class='k'&gt;catch&lt;/span&gt; &lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='nx'&gt;ex&lt;/span&gt;&lt;span class='p'&gt;)&lt;/span&gt; &lt;span class='p'&gt;{&lt;/span&gt;
    &lt;span class='nx'&gt;alert&lt;/span&gt;&lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='s1'&gt;&amp;#39;i = &amp;#39;&lt;/span&gt; &lt;span class='o'&gt;+&lt;/span&gt; &lt;span class='nx'&gt;i&lt;/span&gt; &lt;span class='o'&gt;+&lt;/span&gt; &lt;span class='s1'&gt;&amp;#39;\nerror: &amp;#39;&lt;/span&gt; &lt;span class='o'&gt;+&lt;/span&gt; &lt;span class='nx'&gt;ex&lt;/span&gt;&lt;span class='p'&gt;);&lt;/span&gt;
&lt;span class='p'&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;And got some interesting numbers/errors results:&lt;/p&gt;

&lt;p&gt;on Ubuntu 8.04:&lt;br /&gt;&lt;em&gt;stack sizes&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Firefox 3.0.10: 3,000&lt;/li&gt;

&lt;li&gt;Chromium 2.0.174.0~svn20090412r13572: 21,828&lt;/li&gt;

&lt;li&gt;Rhino 1.4r2: 338&lt;/li&gt;

&lt;li&gt;SpiderMonkey 1.7.0: 1,000&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;errors&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Firefox 3.0.10: InternalError: too much recursion&lt;/li&gt;

&lt;li&gt;Chromium 2.0.174.0~svn20090412r13572: RangeError: Maximum call stack size exceeded&lt;/li&gt;

&lt;li&gt;Rhino 1.4r2: js: exception from uncaught JavaScript throw: java.lang.StackOverflowError&lt;/li&gt;

&lt;li&gt;SpiderMonkey 1.7.0: InternalError: too much recursion&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;on Windows XP SP3:&lt;br /&gt;&lt;em&gt;stack sizes&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Internet Explorer 6.0.2900.5512 SP3: 2,541&lt;/li&gt;

&lt;li&gt;Internet Explorer 7.0.5730.13: 2,555&lt;/li&gt;

&lt;li&gt;Internet Explorer 8.0.6001.18702: 3,076&lt;/li&gt;

&lt;li&gt;Firefox 2.0.0.20: 1,000&lt;/li&gt;

&lt;li&gt;Firefox 3.0.10: 3,000&lt;/li&gt;

&lt;li&gt;Firefox 3.5 Beta 4: 3,000&lt;/li&gt;

&lt;li&gt;Chrome 2.0.172.31: 21,838&lt;/li&gt;

&lt;li&gt;Safari 4 Public Beta (528.16): 43,688&lt;/li&gt;

&lt;li&gt;Opera 9.64: n/a&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;errors&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Internet Explorer 6.0.2900.5512 SP3: Error: Out of stack space&lt;/li&gt;

&lt;li&gt;Internet Explorer 7.0.5730.13: Error: Out of stack space&lt;/li&gt;

&lt;li&gt;Internet Explorer 8.0.6001.18702: Error: Out of stack space&lt;/li&gt;

&lt;li&gt;Firefox 2.0.0.20: InternalError: too much recursion&lt;/li&gt;

&lt;li&gt;Firefox 3.0.10: InternalError: too much recursion&lt;/li&gt;

&lt;li&gt;Firefox 3.5 Beta 4: InternalError: too much recursion&lt;/li&gt;

&lt;li&gt;Chrome 2.0.172.31: name: RangeError, type: stack_overflow, message: Maximum call stack size exceeded&lt;/li&gt;

&lt;li&gt;Safari 4 Public Beta (528.16): RangeError: Maximum call stack size exceeded&lt;/li&gt;

&lt;li&gt;Opera 9.64: Abort (control stack overflow). Script terminated.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can see this code live and running &lt;a href='http://sandbox.javascriptrules.com/stackoverflow/'&gt;here&lt;/a&gt;.&lt;/p&gt;</content>
    </entry>
    
    
    
    
    
    
    
    
    
    
 
</feed>

