1

When I run my Java program in command line in linux (centos), it works, but it gives me heap size error when I run it by Eclipse IDE.

Why? and how can fix it?

Cœur
  • 37,241
  • 25
  • 195
  • 267
  • Try increasing the max heap size in the VM arguments. – M A Jul 10 '14 at 18:06
  • could give me some tips how to do it – user3720447 Jul 10 '14 at 18:07
  • 4
    In the Run Configuration, try adding `-Xmx512m` in the VM arguments section. You can access your run configuration from Run -> Run Configurations. – M A Jul 10 '14 at 18:10
  • 2
    See this answer: http://stackoverflow.com/questions/15313393/how-to-increase-heap-size-in-eclipse (except adjust the memory to some reasonable value, like 512m) – dimoniy Jul 10 '14 at 18:14
  • You might also want to look at your code in the debugger and see what is using so much memory, Unless your making a lot of instances or you have a huge data structure. – TheBetaProgrammer Jul 10 '14 at 18:17
  • Can you update your question with the exact error you're getting? This may be a duplicate of http://stackoverflow.com/questions/37335/how-to-deal-with-java-lang-outofmemoryerror-java-heap-space-error-64mb-heap – M A Jul 10 '14 at 18:20
  • I went to Run->Run Configurations -> VM arguments, but i do know where and how to add this -Xmx512m, and by the way, what is this for? – user3720447 Jul 10 '14 at 18:21
  • I just copyed and pasted it in the box under VM arguments, and It worked :) thank indeed – user3720447 Jul 10 '14 at 18:26

0 Answers0