This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I have written one java program to load some image files and display it in different sizes.
For this I have used BufferedImage, Graphics2D, MediaTracker, Image , JPEGImageEncoder, JPEGImageEncoderParam, RenderOp,ParameterBlock classes. When I run this, I am getting �OutOfMemory�, "core dump" exceptions.
To avoid memory leak I have closed BufferedImage, Graphics2D objects by calling flush(), dispose() methods.
But still I am getting the same exception. Anyhing else i need to close and any other solution for this?
One possibility is the MediaTracker. If you're using a single MediaTracker for many different images, then be sure to call removeImage() when you're done with a given image. But if you're using a different MediaTracker each time, and letting each MediaTracker get GC'ed when you're done with it, then this should not be an issue.
"I'm not back." - Bill Harding, Twister
Joined: Apr 17, 2007
Hi, Thank you for your reply. I will try with -Xmc command.