Increase the JVM heap size using the -Xmx parameter in eclipse under "Run Configurations".
[Only registered and activated users can see links. ]
Whenever that comes up either you should revise your code or just allocate more memory if you're lazy. The latter is generally never better, however in certain cases either may need to be used depending on what it is you're trying to accomplish.
I have provided a picture below. The part you are interested in is outlined in bold black. Change "1024" to the optimal value.