Issue
I've wrote a Java Program that parses through a mysql database and allocates values. The first time I ran this program on a particular table in the database it ran fine and completed. I have tried to run it more times on different tables and it just keeps running out of heap space. Is there anyway that the heap space is decreasing? It feels as though the program runs for a much shorter time now than it was before. The files are no bigger for this program than they were for the first time it was ran.
Solution
That means you might be having a memory leak in your program. Some of the objects you have loaded are not being GCed which reduces available heap space for new objects.
You might be not having some static references (or) DB connections are not closed, it is hard to guess without seeing some code.
Answered By - kosa