Microsoft KB Archive/281148

= BUG: Memory Leak in JScript Array.toString and Array.toLocaleString Methods =

Article ID: 281148

Article Last Modified on 8/15/2001

-

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(&quot;,&quot;) instead of the Array.toString method.

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



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



Steps to Reproduce Behavior
  Create a new .htm file, and then paste the following code:  for (var c = 0 ; c < 1000 ; c++ ) (new Array).toString;   View the page in Internet Explorer. Use the Performance Monitor to watch the private bytes for the IEXPLORE.exe process.

Keywords: kbbug kbscript kbpending KB281148

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.