PowerFlower
PowerFlower

Reputation: 1619

Permanent out of Memory | Java | IntelliJ

i have a Programm with 18 classes. They are working Thread save (checked) have no recursive calls neither do any complex calculation.

But my IDEA always says after some hours

There is not enough memory to perform the requested operation. Pleace increase 'Xmx' setting and restart the IDE for change to take effect.

So I did that. Atm i have no problem.

But still I wonder if I may have a bug there or a Thread is not terminating properly. Since I use WAMP and some other HTTP fuctions I could image that.

  1. So is there any possibility to see what class/thread consumes what amount of memory?
  2. So far I was teached the VM should have a garbage collector. So why I had to restart the IDE always in the past when that error appeared?
  3. If someone here is familar with IntelliJ he/she could maybe answer me beside how i can make my whole project running on a PC what only has a VM installed. Because in the project folder there are only .java files, no class files. When I try to use console with javac "file.java" i receive only a lot of errors. (Project is used with Maven and Intellij 2016.2.5)

Upvotes: 0

Views: 382

Answers (1)

JQian
JQian

Reputation: 226

  1. You can dump the memory with "-XX:+HeapDumpOnOutOfMemoryError" when out of memory error happens; or " -XX:-PrintGC and XX:-PrintGCDetails " for heap/GC information.

  2. Set GC is not enough. You have to tune the GC, saying changing heap size, heap generations and when to do GC to get best performance or to avoid out of memory error. More can read on Link.

  3. You can either get the "jar" file or "class" file to run on other platforms. Or, you can regenerate the class file with source codes on the specified platform.

Upvotes: 1

Related Questions