Allow to run FreeCol with only 512MB memory. Please keep in mind that 2GB is still needed for higher resolution, smoother scroll and high rendering quality.

This commit is contained in:
Stian Grenborgen 2024-01-07 00:04:52 +01:00
parent 2c1a48e4cb
commit fcb4ecd200
2 changed files with 14 additions and 3 deletions

View File

@ -2813,6 +2813,7 @@ error.mapEditorGame=You are trying to start a map (from the map editor) as game.
main.defaultPlayerName=Player Name
main.javaVersion=Java version %minVersion% or better is recommended in order to run FreeCol\n(%version% detected, use --no-java-check to skip this check).
main.memory=You need to assign more than %memory% bytes of memory to the JVM.\n Restart FreeCol with: java -Xmx%minMemory%M -jar FreeCol.jar
main.memoryLow=WARNING! You have started FreeCol with just %memory% bytes of memory to the JVM.\n It's really recommended to run FreeCol with at least 2GB memory.\n Restart FreeCol with: java -Xmx%minMemory% -jar FreeCol.jar
main.userDir.fail=FreeCol can not find suitable directories to save user data in. Proceeding, but expect trouble.
main.userDir.noHome=Could not find the user home directory.
main.userDir.badDir=Not a writable directory: %name%

View File

@ -135,7 +135,6 @@ public final class FreeCol {
/** The maximum available memory. */
private static final long MEMORY_MAX = Runtime.getRuntime().maxMemory();
private static final long MEGA = 1000000; // Metric
public static final String CLIENT_THREAD = "FreeColClient:";
public static final String SERVER_THREAD = "FreeColServer:";
@ -161,7 +160,10 @@ public final class FreeCol {
public static final float GUI_SCALE_STEP = GUI_SCALE_STEP_PCT / 100.0f;
private static final Level LOGLEVEL_DEFAULT = Level.INFO;
private static final String JAVA_VERSION_MIN = "11";
private static final long MEMORY_MIN = 2000000000; // a bit less than 2GB
private static final long MEMORY_MIN = 536500000; // a bit less than 512MB
private static final long MEMORY_MIN_IN_MB = 512; // a bit less than 512MB
private static final long SOFT_MEMORY_MIN = 2000000000; // a bit less than 2GB
private static final long SOFT_MEMORY_MIN_IN_GB = 2;
private static final String META_SERVER_ADDRESS = "meta.freecol.org";
private static final int META_SERVER_PORT = 3540;
private static final int PORT_DEFAULT = 3541;
@ -326,7 +328,15 @@ public final class FreeCol {
// Memory message is in Mbytes, hence division by MEGA.
fatal(StringTemplate.template("main.memory")
.addAmount("%memory%", MEMORY_MAX)
.addAmount("%minMemory%", MEMORY_MIN / MEGA));
.addAmount("%minMemory%", MEMORY_MIN_IN_MB));
}
if (memoryCheck && MEMORY_MAX < SOFT_MEMORY_MIN) {
System.err.println();
System.err.println();
System.err.println(Messages.message(StringTemplate.template("main.memoryLow")
.addAmount("%memory%", MEMORY_MAX)
.add("%minMemory%", SOFT_MEMORY_MIN_IN_GB + "G")));
System.err.println();
}
// Having parsed the command line args, we know where the user