Re: ImageIcon memory sizes



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'
.



Relevant Pages

  • Re: Form loading takes forever after migration
    ... Is there a chance that the network over which the Access front-end links to ... Have an Access application with linked tables to a SQL server. ... By that I recon the problem is before the load event of the main form. ...
    (microsoft.public.access.externaldata)
  • Re: Tories dismayed and paralysed....
    ... It would be a chance for their obscenely wealthy supporters to buy up a load ... of cheap houses and also throw some ordinary working people out on the ...
    (uk.politics.misc)
  • Re: Newbie Question: Doing tasks after form displays on load
    ... > main thread) AFTER the form has initally drawn itself? ... > happening) for 10 seconds for the data to load and the form to paint. ... "idle" windows message that I used to trigger execution after the paint. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Tories dismayed and paralysed....
    ... It would be a chance for their obscenely wealthy supporters to buy up a load ... of cheap houses and also throw some ordinary working people out on the ...
    (uk.politics.misc)
  • Re: tell Pervis its ridiculous reinforcing before a comparison
    ... She may conceive once, forbid late, then paint in the light of the certificate due to the movement. ... She may below load without canadian latin plots. ...
    (sci.crypt)