Looks like, the method I described in that post does not work on all machine or environments.
In one of the environment whose configuration is:
- Windows 7 64 Bit
- 4 GB RAM DDR3
- Intel Core i7 processor
- JDK 6 64 Bit
- PowerMock 1.3.7
Now that's annoying, what the hell is wrong now! Well as I said in the previous post memory leaks are hard to find and fix!
But we need a solution now! Can't wait till PowerMock 1.4 version is released. Hence, I was on a mission to fix the issue and get all my tests running by hook or crook!
In the process I found that, running the tests on a 32 bit machine had no problems what so ever! Surprise, Surprise!
Investigated a little further, found that when tests are run on a machine with 64 bit OS but 32 bit JDK they all pass. That was the moment of Truth!
These are the steps I followed to fix the OutOfMemoryError:
- Installed the JDK 6 32 bit on my machine
- Updated the JAVA_HOME environment variable
- Added the JDK 6 32 bit bin directory to the PATH environment variable
- Removed the earlier JDK 6 64 bit bin directory from the PATH environment variable.