OdeToCode IC Logo

The Trivial Things You Can Learn When Stress Testing an AJAX Application

Friday, January 18, 2008

Internet Explorer has no problem creating an array of 65,536 elements.

var array = [];
for(var i = 0; i < 65535; i++)

// says 65536

However, IE does have a problem eval-ing an array of 65,536 elements.

var buffer = '[0';
for(var i = 0; i < 65535 / 15; i++)
    buffer +=
buffer +=

var array = eval(buffer);    
// would be 65536,
                     // if it got this far..

The code produces an out of memory error on the eval statement. The limit for eval appears to be 65,535 – a number that harkens back to the dark, dismal days of programming in a segmented memory architecture.

Of course, if you came here looking for the upper limits of evalyou might be doing something wrong!

Josh Stodola Friday, January 18, 2008
Ahhh yes, two to the power of sixteen minus one. Hear about the Excel bug related to this number?

scott Friday, January 18, 2008
Wow - when that paper says it will analyze a bug - it isn't kidding!!
Comments are closed.