Another possibility is that you have some sort of recursion or infinite loop that keeps allocating objects until the JVM finally runs out of memory. I'd suggest taking a close look at your code. If you can't find the leak, you might try running it through a debugger or profiler.