I'm working on a project that uses the gifAnimation library to load numerous local animated GIFs. It's working great, but I'm getting an OutOfMemoryError after loading a large number of GIFs (over 100).
I'm removing the GIF objects from draw() when I wish to remove them from the screen, but I can't figure out how to remove them from memory.
I'm storing a reference to the each GIF in "ArrayList<Gif> gifObjectList" and calling the function below in an attempt to remove them from memory, but it doesn't seem to be working:
void deleteAllAnimatedGif() {
for (int i = 0; i< gifObjectList.size(); i++) {
Gif currGifToNuke = gifObjectList.get(i);
println("currGifToNuke = "+currGifToNuke); //comes back with reference like gifAnimation.Gif@115c974
currGifToNuke = null;
println("currGifToNuke = "+currGifToNuke); //comes back with null
gifObjectList.set(i,null);
}
gifObjectList.clear();
}
I tried setting the value of the object to "null", which was what I found searching the forums, but I continue to get OutOfMemoryError using this method.
Any suggestions would be greatly appreciated.
Thanks,
Brent
1