L
Luke
I have a large .jpg file, about 2.7M, which I'm converting to an
ImageIcon. I'm trying to find out how much memory the ImageIcon is
using with a code snippet like this,
byte[] b = ... the .jpg data
System.out.println(Runtime.getRuntime().totalMemory());
ImageIcon icon = new ImageIcon(b);
System.out.println(Runtime.getRuntime().totalMemory());
It appears that the ImageIcon is using over 60M of memory. Can this be
possible?
My goal is to display an image in a JScrollPane. I'm creating a JLabel
and setting it's icon to the ImageIcon. This is apparently taking
*lots* of memory. When I get a chance I'm going to try the alternate
approach of creating an Image and then using a Graphics.drawImage() call
to paint the image myself. I hope this will use much less memory.
ImageIcon. I'm trying to find out how much memory the ImageIcon is
using with a code snippet like this,
byte[] b = ... the .jpg data
System.out.println(Runtime.getRuntime().totalMemory());
ImageIcon icon = new ImageIcon(b);
System.out.println(Runtime.getRuntime().totalMemory());
It appears that the ImageIcon is using over 60M of memory. Can this be
possible?
My goal is to display an image in a JScrollPane. I'm creating a JLabel
and setting it's icon to the ImageIcon. This is apparently taking
*lots* of memory. When I get a chance I'm going to try the alternate
approach of creating an Image and then using a Graphics.drawImage() call
to paint the image myself. I hope this will use much less memory.