From 9f71f7e3dbf2abe3ea82ad8d679836c0c039cead Mon Sep 17 00:00:00 2001 From: Thinkofdeath Date: Sat, 28 Dec 2013 23:54:44 +0000 Subject: [PATCH] Handle different sizes (G,K) for the PermGen warning --- .../0084-Warn-if-PermGen-may-be-insufficient.patch | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/CraftBukkit-Patches/0084-Warn-if-PermGen-may-be-insufficient.patch b/CraftBukkit-Patches/0084-Warn-if-PermGen-may-be-insufficient.patch index 9f2bb4f166..b40270807f 100644 --- a/CraftBukkit-Patches/0084-Warn-if-PermGen-may-be-insufficient.patch +++ b/CraftBukkit-Patches/0084-Warn-if-PermGen-may-be-insufficient.patch @@ -1,27 +1,28 @@ -From 1fdd743f7d9574e16efdc4831324a18d7847dc47 Mon Sep 17 00:00:00 2001 +From c1ec14127cc9b7047ec70ff080c817a0a408d7f3 Mon Sep 17 00:00:00 2001 From: md_5 Date: Mon, 23 Dec 2013 14:07:41 +1100 Subject: [PATCH] Warn if PermGen may be insufficient diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index 07c26f1..9952087 100644 +index 07c26f1..7e7b1ec 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java -@@ -149,6 +149,20 @@ public class Main { +@@ -149,6 +149,21 @@ public class Main { useConsole = false; } + // Spigot Start -+ int maxPermGen = 0; ++ int maxPermGen = 0; // In kb + for ( String s : java.lang.management.ManagementFactory.getRuntimeMXBean().getInputArguments() ) + { + if ( s.startsWith( "-XX:MaxPermSize" ) ) + { + maxPermGen = Integer.parseInt( s.replaceAll( "[^\\d]", "" ) ); ++ maxPermGen <<= 10 * ("kmg".indexOf( Character.toLowerCase( s.charAt( s.length() - 1 ) ) ) ); + } + } -+ if ( maxPermGen < 128 ) ++ if ( maxPermGen < (128<<10) ) // 128mb + { + System.out.println( "Warning, your max perm gen size is not set or less than 128mb. It is recommended you restart Java with the following argument: -XX:MaxPermSize=128M" ); + } @@ -30,5 +31,5 @@ index 07c26f1..9952087 100644 MinecraftServer.main(options); } catch (Throwable t) { -- -1.8.3.2 +1.8.4.msysgit.0