Details
-
Bug
-
Status: Open
-
Resolution: Unresolved
-
1.8
-
None
-
Operating System: Windows Vista
Platform: PC
Description
To reproduce, succesively add, start and remove many many animation elements in a document programatically. The result is a memory leak caused by elements accumulating in two hash maps called animations and targets in the class AnimationEngine.
Possible solution: removing elements from these two maps when an animation is removed, last two lines in the method.
/**
- Removes an animation from the document.
*/
public void removeAnimation(AbstractAnimation anim) {
// org.apache.batik.anim.timing.Trace.enter(this, "removeAnimation", new Object[] { anim }); try
Unknown macro: { timedDocumentRoot.removeChild(anim.getTimedElement()); AbstractAnimation nextHigher = anim.higherAnimation; if (nextHigher != null) { nextHigher.markDirty(); } moveToBottom(anim); if (anim.higherAnimation != null) { anim.higherAnimation.lowerAnimation = null; } AnimationInfo animInfo = getAnimationInfo(anim); Sandwich sandwich = getSandwich(animInfo.target, animInfo.type, animInfo.attributeNamespaceURI, animInfo.attributeLocalName); if (sandwich.animation == anim) { sandwich.animation = null; sandwich.lowestAnimation = null; sandwich.shouldUpdate = true; } animations.remove(anim); targets.remove(animInfo.target); // }finally
{ org.apache.batik.anim.timing.Trace.exit(); }}
This might not be the best solution.
I use latest version of batik sources from svn trunk repository. Version from trunk: xml-batik 746059