JScript memory leak 
Author Message
 JScript memory leak

I've come across a problem which looks like a JScript memory leak. Initially
I found it through ASP, but client side JavaScript appears to cause it too.

Sample code is:


<%
function Thing(data) {
    this.a = new Array(1,2,3);

Quote:
}

for (var i=0; i<1000; i++) {
    var t = new Thing();
    Response.Write(t.a+'<BR>\n');
Quote:
}

%>

When I run it in a seperate memory space the instance of mtx.exe attached to
it grows in memory by several Mb each iteration. This memory DOES NOT get
released. I can run it over and over until that instance of mtx.exe uses all
the available memory on the machine.

There appear to be 2 factors that cause the leak. First, the creation of an
Array in the object Thing. Creating a String for example does not cause the
problem. Second, the Array must be referenced in the loop outside the
object.

Setting the object and the Array to null does not appear to help. I've tried
the delete operator, and also CollectGarbage() but neither appear to fix it.

Making a client side script with the equivalent code makes the memory
allocated to iexplore.exe grow in the same way.

I'm running NT Server 4 SP5 with scripting version 5.5. I've tried it on SP4
and SP6 with the same result.

Does anyone have any ideas? Might upgrading to 2000 help?

thanks,
Andy



Sat, 19 Apr 2003 08:13:33 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Bug Report: JScript Memory Leak

2. JScript Memory Leak

3. JScript Memory Leak

4. Memory Leak in JScript Engine?

5. BUG: Memory Leak in JScript toString and toLocaleString Methods

6. pscal memory leaks

7. bizarre memory leak in IISx

8. array memory leak HELP!

9. Behavior memory leak, part 2

10. VBScript Function causes memory leak!

11. Huge Memory Leak if you use JavaScript in IE4

12. memory leak?

 

 
Powered by phpBB® Forum Software