In Java, a virtual machine preallocates a bunch of memory that cannot be expanded at run time. A developer can increase the heap size with the -Xmx switch when loading the VM, but there is no way to increase the maximum heap size at run time. Why is this?
There is no reason in the JVM specification why heap size should be specified in advance, except that it was the choice of the developers. The specification states: "The implementation of the Java Virtual Machine can give the programmer or user control over the initial heap size, and if the heap can be dynamically expanded or reduced, control the maximum and minimum heap size."
The other answers here are simply incorrect: "The heap can have a fixed size or can be expanded as required by the calculation, and can be reduced if a large heap becomes unnecessary."
Source: Java Virtual Machine Specification, Java SE 7 Version. Section 2.5.3, “Heap”. This is page 13 of the print edition.
- , . , , . , , ( , @mttdbrd), .
Java, 1 , , 256 , ! , , , , . , , , () .
, , , , , , .
, , , , , , , Java- , , .
, , .
, JVM . , , , , , .;)
Source: https://habr.com/ru/post/1533769/More articles:DynamoDB and .NET Persistence Model using "ADD" values instead of overwriting - c #angular-google maps getting a geo location with the mouse - angularjshttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1533766/disconnecting-reconnecting-clients-to-the-receiver-session&usg=ALkJrhhGcslQdMYFQAxPdp-OcFpjVq_0WwИмитация iBeacon с macOS - iosWhere does Xcode store $ {PRODUCT_NAME} on the file system? - iosAlertDialog with EditText with Email InputType - Android - javaRemoving a FolderItem Object - c #MongoDB - экранирование цитат при вставке записи - bashReadAsAsync <> в PCL Repack из System.Net.Http.Formatting library - c#If some naming conventions, such as uppercase names, are so unapproved, why do languages allow them at all? - javaAll Articles