Re: ImageIcon memory sizes
- From: Andrew Thompson <SeeMySites@xxxxxxxxxxx>
- Date: Sat, 10 Sep 2005 09:57:19 GMT
On Sat, 10 Sep 2005 03:45:19 -0500, Luke wrote:
> ..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.
That is probably the better way to go about what you
are doing, I cannot speak for the size of Images as opposed
to ImageIcons, but Java is generally horrendous when iy comes
to image representations, as well as *caching* (very relevant
if you intend to load more than one image at any time during
the course of your application).
I found the nes approach was to load the image bytes
yourself and use Toolkit.createImage() to stamp out an
Image as required.
I see 'Ex-Guardian Reader' has given you a tip re 'catch'ing
your OutOfMemory*Error*s, but I'll just add that it would
have been easier to determine that you were..
try {
// images stuff
}
catch (Exception e) {
// won't catch an 'Error'!
....
If you had posted an SSCCE. <http://www.physci.org/codes/sscce.jsp>
You might also Google this group for recent discussions
about what to do once you have caught those OOME's.
HTH
--
Andrew Thompson
physci.org 1point1c.org javasaver.com lensescapes.com athompson.info
"Ain't it dark, wrapped up in that tarp.."
Dixie Chicks 'Goodbye Earl'
.
- References:
- ImageIcon memory sizes
- From: Luke
- ImageIcon memory sizes
- Prev by Date: Re: catching an OutOfMemoryError
- Next by Date: Re: Correct Identation/Contex can solve the too many compiler error messages problem when a closing bracket is missing.
- Previous by thread: Re: ImageIcon memory sizes
- Next by thread: Re: ImageIcon memory sizes
- Index(es):
Relevant Pages
|