OutOfMemory errors

I only get out of memory errors on really big resolution running machines because at times I need to hold two buffers of the screen at a time. Maybe I can do better than that, so I think I’ll ask about that too… So I figure if a machine is running a resolution higher than 1152x864 it should have a good amount of ram, so I should be able to hold those buffers without too much worry of running out of memory. However at times I get OutOfMemory exceptions, so I think I need to increase the heap. How can I do this when running a jar locally or running a jar through Webstart?

Second, I’ll ask about the reason why I’m using so much memory. In my game I want to fade when opening or closing a menu, but I’ve found that simply rendering the two, and the top one with a diminishing AlphaComposite, takes a long time. If I hold two arrays of ints for the two menu’s, and combine them myself, and use a custom class to throw that to the screen, it’s MUCH faster, in every case I’ve tried. However… this means I hold a lot of stuff. For one, I hold two arrays of the dimensions of the screen, and I also hold on to the two BufferedImages those guys origionate from since it’s faster to just draw over them when I need to than to recreate them whenever I open/close a menu. But that means on a 2400x1600 resolution display (which I’ve been testing with), assuming 4 bytes per pixel in my two arrays and the two BufferedImages, that’s 60 megs I have to grab just to open or close a menu. That’s a freaking lot. Any suggestions for an alternate method to fade my screen quickly? The limit here is Java2D. Thanks!

Max heap in webstart -

You can’t do it from the manifest of a jar. You’d need to specify it on the command line.

Kev

ok and how would I do that from the command line?

java -Xmx256m -Xms64m etc…

Kev

I ran:
java -jar rimscape.jar -Xmx800m -Xms512m
and still got the same OutOfMemory exception at the same place… sooo… I think having enough memory available isn’t the problem.

Any suggestions for how I can manage screen fading better?

I believe the -X parameters have to be the first on the command line to take any effect. Otherwise they get passed into the program as arguments rather than going into the VM…

Kev

That seems to have done it, thanks a lot!