out of memory for Java application
I'm creating a Java application for image processing , and after a while of working on this program I got Out of memory exception because I think the Image objects taking a lot of mem开发者_开发百科ory space ,I can save the images as files to hard disk and read them when i need but that may took milli-seconds vs Nano-seconds if I use RAM with object.what I can do to solve this?
First of all, use a memory profiler such as YourKit
to figure out what it is exactly that's consuming the memory (for example, it could be due to the accidental retention of some unneeded references). Once you understand how your program is actually using the memory, you can formulate a plan of attack.
Perhaps you have issues with not disposing images you are not using.
精彩评论