dimanche 26 octobre 2014

JVM Xmx argument only works with Xms, maybe even not work properly


Vote count:

0




I encountered a OutOfMemoryError: java heap space when trying to create a long byte array(139708800 bytes, meaning 134M).



  1. In order to solve this problem, I change the -Xmx argument of the JVM from default value(256M) to 1G. However, the OutOfMemoryError still remains. (I tried many times, sometimes error, sometimes no problem)

  2. Then I change the -Xms argument of the JVM from 16M to 256M, the error disappears. (I am not sure if the problem will never appear with this setting)


I used jconsole to monitor my heap size change, found that the heap size is much less than 1G.


What I know: The size of heap will adjust after GC. And we are advised to set Xms the same as Xmx. (don't tell me these two things repeatedly)


My question: I just want to know, why after the first step, the error remains.



asked 1 min ago







JVM Xmx argument only works with Xms, maybe even not work properly

Aucun commentaire:

Enregistrer un commentaire