free memory of bufferedimage
hi all,
i have the following code.
BufferedImage img=new BufferedImage(29342,450,BufferedImage.TYPE_INT_RGB );
Graphics2D g2d=img.createGraphics();
g2d.drawImage(r.getAsBufferedImage(), 0, 0, null);
g2d.finalize();
g2d.dispose();
img.flush();
img=null;
but i cannot free img object all uts memory since i know there is the reference to it, but for this problem how to solve it? thanks.
Re: free memory of bufferedimage
You should not directly call finalize...this is for the garbage collector. The g2d.dispose() call should release all resources associated with the Graphics object you created. The garbage collector works on its own time, and it will free up the memory to unreferenced/out of scope objects when it sees fit - which may or may not be immediately
Re: free memory of bufferedimage
How much memory does this image take up?
Whats the reason for loading an image in of this size anyways?
// Json