JScript array elements become null when being created repeatedly. RRS feed

  • Question

  • Hi,

    I've experienced this weird bug with Miscrosft's JScript. When I repeatedly call a function that declares an array locally for a few million times, the elements inside the locally declared array will become undefined without any modification. Here is a sample script that I've created that can reproduce this issue.

    var wshShell = WScript.CreateObject("WScript.Shell");
    function Test(index) {
    	var ar = ["a", "bc", "def", "g", "hijk", "lm", "n", "opqr", "rst", "uvw", "xyz", "0", "1"];
    	if (typeof ar[0] === "undefined") {
    		// shouldn't be possible because nothing is being done to the array ar
    		wshShell.Popup("Index " + index, 0, "Bug", 0x0 + 0x40);
    for (var j = 0; j < 6000000; j++) {
    wshShell.Popup("DONE", 5, "Title", 0x0 + 0x40);

    If the above script is saved and run on Windows, (which takes a couple of seconds to complete), the Bug popup inside the Test function will pop up for around 2 to 3 times, which should not be happening.

    * I am using Windows 7 64bit OS, with JScript.dll version 5.8.7600.16475, IE8.

    Anyone has seen this problem before?

    Where should I file this bug?

    Monday, August 29, 2011 2:13 PM