Uploaded image for project: 'Batik'
  1. Batik
  2. BATIK-891

[PATCH] Animation engine memory leak

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Resolution: Unresolved
    • Affects Version/s: 1.8
    • Fix Version/s: None
    • Component/s: Animation engine
    • Labels:
    • Environment:
      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

        Attachments

        1. Bug46811-MemoryLeak.patch
          0.4 kB
          Helder Magalhães

          Activity

            People

            • Assignee:
              batik-dev@xmlgraphics.apache.org Batik Developer's Mailing list
              Reporter:
              cristi.mim@gmail.com Cristi Moise
            • Votes:
              1 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: