Right click source code of the class where your main function is. Then select Run As and Run Configurations. Choose the "Arguments" tab and indicate how much memory you wanna allocate in the VM arguments part. eg: -xmx128m 
here is a screenshot:

Also, you can find descriptions of other parameters on 
 this webpage.