Java process gets killed after depleting system memory. Why?

286 views Asked by At

I'm running an Java app on Ubuntu 12.04.3 x64 VPS using Oracle Java. After few minutes the process gets killed by the OS: "killed" appears in the console.

Before the crash, excessive memory usage can be seen using TOP (few gigabytes of virtual memory). In order to inspect the leak I have installed the Java VisualVM and connected to it remotely through jstatd. No signs of leak can be seen:

  • Heap size: 10 MB
  • PermGen space size: 20 MB
  • Threads: 5
  • Classes loaded: 815

After few tries, the hs_err_pid7071.log and hs_err_pid7057.log appeared in the apps directory (linked).

There are some native libraries used by the app.

I run jcmd 8749 VM.native_memory detail and got this result. VM was using about 2 GB of memory at the time.

Removing this line makes the leak disappear:

Kryo kryo = new Kryo();
return kryo.copy(gameWorld);

Documentation of this method

1

There are 1 answers

0
Nikem On

I see this line in your hs* files:

Memory: 4k page, physical 502752k(372080k free), swap 0k(0k free)

Is it true, that your machine has only around 370M of free memory? And you try to start JVM process with "jvm_args: -Xms1g" ? Where from this 1G could come?