fix #1922: Add Xms only when the min memory is less than the max memory (#1949)

This commit is contained in:
Glavo 2022-12-30 01:59:02 +08:00 committed by GitHub
parent 2e7e2d261c
commit 4c2d1063ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -136,7 +136,8 @@ public class DefaultLauncher extends Launcher {
if (options.getMaxMemory() != null && options.getMaxMemory() > 0)
res.addDefault("-Xmx", options.getMaxMemory() + "m");
if (options.getMinMemory() != null && options.getMinMemory() > 0)
if (options.getMinMemory() != null && options.getMinMemory() > 0
&& (options.getMaxMemory() == null || options.getMinMemory() <= options.getMaxMemory()))
res.addDefault("-Xms", options.getMinMemory() + "m");
if (options.getMetaspace() != null && options.getMetaspace() > 0)