So. Here's a couple of emails I sent to the DWR list a while back. They never got a reply.
Christofer Jennings --- Sat, Jul 7, 2007 at 3:07 PM
To: users@dwr.dev.java.net
There might be an IE memory leak in engine.js related to timeout settings.
I've been chasing a memory leak for quite a while. After many tests, I
think I've isolated it to setting a timeout for a DWR call. Below is
the lines in dwr version 2.0.1's engine.js that I think look
suspicious because of the function block / closure (lines 634 - 635).
Below that is my jsp with a comment on the timeout line. The poll
method returns a response object with a message property, but
otherwise it's pretty straight forward. Attached is the Process
Explorer memory use graph showing slopes for when the timeout is set,
as well as no slope when timeout is not set.
My tests were all done using IE 7 (version 7.0.5730.11) on Windows XP,
but I've seen the (possibly) same leak in IE 6. I think they are the
same as far as this is concerned.
In any case, my next test will be to change the closure to a function reference.
Does this look right? Has anyone else had trouble with timeout
settings and IE memory leaks?
,chris
#### from engine.js ######
if (batch.timeout && batch.timeout != 0) {
batch.interval = setInterval(function() {
dwr.engine._abortRequest(batch); }, batch.timeout);
}
#### my jsp ############
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>DWR Poll Test</title>
<script type='text/javascript' src='../dwr/interface/MyObject.js'></script>
<script type="text/javascript">
function doPoll()
{
MyObject.poll(
{
timeout: 2000, /* removing this line stops the leak */
callback:function(response)
{
var now = new Date();
var msg = now + "\n----------------------";
msg += "\n message = " + response.message;
msg += "\n----------------------\n" + now;
dojo.byId("theTextArea").value = msg;
}
});
}
window.setInterval(doPoll, 1000);
</script>
</head>
<body>
<h2>DWR Poll Test</h2>
<textarea id="theTextArea" rows="10" cols="60"></textarea>
</body>
</html>

Christofer Jennings -- Sun, Jul 8, 2007 at 10:44 AM
To: users@dwr.dev.java.net
Using a function reference stopped the leak. It can probably be done
better, but the change I made for the test is below. The resulting
graph is attached.
#### from modified enjine.js ######
dwr.engine._chris_abort_batch;
dwr.engine._chris_abortRequest = function()
{
dwr.engine._abortRequest(dwr.engine._chris_abort_batch);
}
/** @private Actually send the block of data in the batch object. */
dwr.engine._sendData = function(batch) {
...
// Set a timeout
if (batch.timeout && batch.timeout != 0) {
dwr.engine._chris_abort_batch = batch;
batch.interval = setInterval(dwr.engine._chris_abortRequest, batch.timeout);
// batch.interval = setInterval(function() {
dwr.engine._abortRequest(batch); }, batch.timeout);
}
...

Final note: This "fix" is a complete HACK. I don't recommend it at all.
