extrapixel / gif-animation

GifAnimation is a Processing library to play and export GIF animations
GNU General Public License v3.0
171 stars 38 forks source link

Fix memory leak in Gif #2

Closed aib closed 9 years ago

aib commented 9 years ago

Hi, I found a memory leak in Gif's constructor, preventing it from being garbage collected.

While fixing this, I also cooked up a small ANT build file (tied to my machine, by a single line) and updated the JAR in the process.

aib commented 9 years ago

For anyone reading this, it's also possible to work around this bug by subclassing Gif:

class FixedGif extends Gif {
  private PApplet parent;

  FixedGif(PApplet parent, String filename) {
    super(parent, filename);
    this.parent = parent;
  }

  public void dispose() {
    parent.unregisterDispose(this);
    super.dispose();
  }
}