More memory tuning on BufferedImage handling, workaround bukkit leak

This commit is contained in:
Mike Primm 2011-05-29 09:33:51 -05:00
parent a25fcc0001
commit 544283a650
2 changed files with 17 additions and 1 deletions

View file

@ -293,8 +293,8 @@ public class KzedMap extends MapType {
img.width = x;
img.height = y;
img.argb_buf = new int[x*y];
img.buf_img = createBufferedImage(img.argb_buf, img.width, img.height);
}
img.buf_img = createBufferedImage(img.argb_buf, img.width, img.height);
return img;
}
@ -303,6 +303,7 @@ public class KzedMap extends MapType {
*/
public static void freeBufferedImage(KzedBufferedImage img) {
img.buf_img.flush();
img.buf_img = null; /* Toss bufferedimage - seems to hold on to other memory */
synchronized(lock) {
long k = (img.width<<16) + img.height;
LinkedList<KzedBufferedImage> ll = imgcache.get(k);