When I run a Java program with an initial 3G heap size (set by the VM argument -Xms3072m), the JVM does not start from that size. It starts at 400 meters or so, and then continues to acquire more memory as needed.
This is a serious problem for me. I know that after a while the JVM will be needed. And when the JVM increases its memory as needed, it slows down. During the time when the JVM acquires more memory, a significant amount of time is spent on garbage collection. And I believe that acquiring memory is an expensive task.
How to ensure that the JVM really takes into account the start heap size parameter?
Update: This application creates many objects, most of which die quickly. Some resulting objects must remain in memory (which are passed from the young heap). During this operation, all of these objects must be in memory. After the operation, I see that all objects in the young heap are successfully declared. Thus, there are no memory leaks.
The same operation runs smoothly when the heap size reaches 3G. This clearly indicates that the extra time spent on acquiring memory,
This is Sun JDK 5.
, Java . , 3 Xms, Java , , ... ( ). .
JVM Xms , . GC . GC , GC, Xms Xmx, , , Xmx.
, , ... 1 -XX: NewSize = 1g, "" "" . , , JVM , , , , . , , , -...
!
, , .
, GC, . .
, , , .
- GC.
-Xms ( JVM, ). , , .
-Xms
sun vm 14 , . , xms xmx amt, .. -Xms3072m -Xmx3072m
, ? , 400 , , .
, . 400 , ? , , , :
, , , , . , "" . , , ..
. . . , , .
, . ( gc). , "" . , . .
, gc , , , -. ,
Runtime r = Runtime.getRuntime(); r.gc();
This is just for debugging purposes. Gc does a great job most of the time, so it should not be necessary to invoke gc yourself.
Source: https://habr.com/ru/post/1708326/More articles:ASP.NET caching issue - cachingКак предотвратить svn от расширения ключевого слова $Id $? - svnLiferay-ui: icon localization - portletHow to remove a fragment in Visual Studio C # Express? - c #IE8 зависает, когда одновременно запускается более 4 асинхронных XmlHttpRequests - internet-explorerFile System Testing Tools - linuxC # How to find the size of a reference type - c #Submitting AjaxForm using jQuery in ASP.NET MVC - jqueryIs there a way to prevent dll from opening in software such as a reflector? - c #Report generation in PHP (pdf, xls, doc, csv format required) - phpAll Articles