3

I'm currently having this problem where I am executing a query that will load large of records. At first execution, it is successful, but when I execute again, I am having java heap size out of memory.

I Know I can increase java heap size using command line, but that requires a compiled jar file. But I am currently on the development process, so how can I increase java heap size in that case?

Im using Elipse as my IDE.

Thanks for any response.

trincot
  • 317,000
  • 35
  • 244
  • 286
Jc dev
  • 355
  • 1
  • 6
  • 15
  • See this question: http://stackoverflow.com/questions/880855/increase-the-java-heap-size-permanently. Is that what you are looking for? – joscarsson Mar 10 '12 at 08:14
  • Be careful. It may be that you're not using Hibernate properly and it certainly sounds like the application you're building could end up with memory issues. – James DW Mar 10 '12 at 17:08
  • @ james DW, although it worked by adding a vm argument -Xmx1024m, I am still considering your suggestion, I think there is also problem on how I used hibernate that's why I'm having this error! – Jc dev Mar 11 '12 at 23:45

3 Answers3

3

It doesn't require a compiled jar file. Choose Run - Run configurations... - Select your run configuration - Arguments tab. Then enter the appropriate command line argument in the VM arguments text box: -Xmx1024m for example.

JB Nizet
  • 678,734
  • 91
  • 1,224
  • 1,255
0

You can modify the eclipse.ini file located inside of our eclipse directory .
There you will find Xms40m Xmx256m parameter with some value , you can increase it to Xms256m Xmx1024m . Then check whether outofmemory error is still there . If its there then try tuning these parameter slightly increasing and check.

arshwarsi
  • 182
  • 1
  • 8
  • 1
    This will modify Eclipse's own memory parameters. It won't change the memory parameters of the programs launched by Eclipse. – JB Nizet Mar 10 '12 at 08:15
  • Yeah right . Actually all the component using java memory can be handeled by providing these parameters in different places. Like when when starting the server with these parameters – arshwarsi Mar 10 '12 at 08:18
0

Apperently that was not enough for an answer... well, let me just copy the text from those answers instead :S

You can use the environment variable _JAVA_OPTIONS to set the default heap size. This will change the heap size for all Java programs. Like this:

export _JAVA_OPTIONS="-Xmx1g"

joscarsson
  • 4,789
  • 4
  • 35
  • 43