简体   繁体   中英

Java allocating more RAM when lots is already free

Please note: This is for a Minecraft server.

In Java, what options can I specify to make Java not allocate RAM until all free RAM is filled?

Here is a picture of my RAM usage currently:

Allocated Memory: 1458MB
Free Memory: 514MB
Totaly Memory: 4062MB

Task Manager says Java is using 1458MBs of RAM, which is the problem. The server is only using 944MBs (1458-514) and I want a way to keep memory usage as low as possible, until that space is filled.

Current arguments: -server -Xincgc -Xms512M -Xmx4096M -XX:ParallelGCThreads=4 -XX:+AggressiveOpts -jar cauldron.jar nogui

You are using the -Xmx4096M argument, which allows the JVM to allocate up to 4096MB of memory. If you would like to reduce this memory usage in your system, you should reduce this value.

From the java tool documentation:

-Xmxsize

Specifies the maximum size (in bytes) of the memory allocation pool in bytes. This value must be a multiple of 1024 and greater than 2 MB. Append the letter k or K to indicate kilobytes, m or M to indicate megabytes, g or G to indicate gigabytes. The default value is chosen at runtime based on system configuration.

The -Xmx option is equivalent to -XX:MaxHeapSize.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM