This is because increasing the heap beyond the capabilities of your server to adequately Garbage Collect can cause other problems (eg performance/freezing) Increase Xmx in small increments (eg 512mb at a time), until you no longer experience the OutOfMemory error.If you do decide to increase the memory settings, there are a few general guidelines to follow:
In case you need advice regarding how much memory you should use please check this page for some examples of hardware specifications.