Wednesday, July 28, 2010

My First Major Memory Leak

Just over an hour ago, I encountered this initially frightening error: "OutOfMemoryError: GC overhead limit exceeded". I broke the garbage collector...woohoo!

Stumped about what might be eating up heap space, I immediately put my great Googling Powers™ to work, and soon found Eclipse Memory Analyzer (MAT).

Turns out I wasn't closing the ResultSets and Statements (?) properly. What a great program! All you have to do is generate a heap dump file from your exception-spewing program, feed it into MAT and it gives you a leak report, with charts and details. Very helpful!

Here's a great tutorial for using it: Eclipse Memory Analyser (MAT) - Tutorial. You don't have to download MAT as an Eclipse plugin (i.e. through the software updates window), you can download it from the site as a separate program.

No comments:

Post a Comment