BUG: Memory Leak in JScript Array.toString and Array.toLocaleString Methods (281148)



The information in this article applies to:

  • Microsoft JScript 5.5

This article was previously published under Q281148

SYMPTOMS

If you use the toString or toLocaleString methods of the Array object in JScript, you may notice that the host process does not release the memory that is used by these methods.

This bug does not occur in JScript version 5.0 or earlier.

CAUSE

This problem occurs because a reference to the Array object that is used in these methods is never released.

RESOLUTION

To resolve this problem, use Array.join(",") instead of the Array.toString method.

For example, instead of this
(new Array("hello","world")).toString();
				
use this:
(new Array("hello","world")).join(",");
				

STATUS

Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.

MORE INFORMATION

Steps to Reproduce Behavior

  1. Create a new .htm file, and then paste the following code:
      <SCRIPT LANGUAGE="JScript">
        for (var c = 0 ; c < 1000 ; c++ )
          (new Array()).toString();
      </SCRIPT>
    					
  2. View the page in Internet Explorer.
  3. Use the Performance Monitor to watch the private bytes for the IEXPLORE.exe process.

Modification Type:MajorLast Reviewed:8/15/2001
Keywords:kbbug kbDSupport kbScript KB281148