Hi,
Here is a quick fix concerning a memory leakage in DomNode$LiveNodeList.
I have noticed using jmp that nearly all
LiveNodeList were not freed. Actually the GC cannot collect them because
LiveNodeList has removed a dependency
on DomIterator but without detaching it from the event to be listened
to. This patch fixes this by properly detaching the
iterator. However it looks to me that it represents a cache so maybe
current should not be assigned to null in all occasions.
Regards,
Guilhem.
ChangeLog:
2005-12-23 Guilhem Lavaux <[EMAIL PROTECTED]>
* gnu/xml/dom/DomNode.java
(LiveNodeList.handleEvent,
LiveNodeList.item, LiveNodeList.getLength): Detach properly the iterator
from the DomNode.
Index: gnu/xml/dom/DomNode.java
===================================================================
RCS file: /cvsroot/classpath/classpath/gnu/xml/dom/DomNode.java,v
retrieving revision 1.8
diff -u -r1.8 DomNode.java
--- gnu/xml/dom/DomNode.java 15 Dec 2005 18:37:09 -0000 1.8
+++ gnu/xml/dom/DomNode.java 23 Dec 2005 17:31:12 -0000
@@ -1336,7 +1336,9 @@
{
return;
}
-
+
+ if (current != null)
+ current.detach();
current = null;
}
@@ -1355,6 +1357,7 @@
lastIndex--;
}
Node ret = current.previousNode ();
+ current.detach();
current = null;
return ret;
}
@@ -1363,7 +1366,8 @@
while (++lastIndex != index)
current.nextNode ();
Node ret = current.nextNode ();
- current = null;
+ current.detach();
+ current = null;
return ret;
}
@@ -1376,7 +1380,7 @@
{
retval++;
}
- current = null;
+ iter.detach();
return retval;
}
_______________________________________________
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches