https://issues.apache.org/bugzilla/show_bug.cgi?id=46811

           Summary: Animation engine memory leak
           Product: Batik
           Version: 1.8
          Platform: PC
        OS/Version: Windows Vista
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Animation engine
        AssignedTo: [email protected]
        ReportedBy: [email protected]


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 {
        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

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to