I am trying to insert about 50,000 objects (and therefore 50,000 keys) into a java.util.HashMap
. However, I keep getting an OutOfMemo
You probably need to set the flag -Xmx512m or some larger number when starting java. I think 64mb is the default.
Edited to add: After you figure out how much memory your objects are actually using with a profiler, you may want to look into weak references or soft references to make sure you're not accidentally holding some of your memory hostage from the garbage collector when you're no longer using them.