2013-12-29 00:54:44 +01:00
From c1ec14127cc9b7047ec70ff080c817a0a408d7f3 Mon Sep 17 00:00:00 2001
2013-12-23 04:08:28 +01:00
From: md_5 <git@md-5.net>
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
2013-12-29 00:54:44 +01:00
index 07c26f1..7e7b1ec 100644
2013-12-23 04:08:28 +01:00
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
2013-12-29 00:54:44 +01:00
@@ -149,6 +149,21 @@ public class Main {
2013-12-23 04:08:28 +01:00
useConsole = false;
}
+ // Spigot Start
2013-12-29 00:54:44 +01:00
+ int maxPermGen = 0; // In kb
2013-12-23 04:08:28 +01:00
+ for ( String s : java.lang.management.ManagementFactory.getRuntimeMXBean().getInputArguments() )
+ {
+ if ( s.startsWith( "-XX:MaxPermSize" ) )
+ {
+ maxPermGen = Integer.parseInt( s.replaceAll( "[^\\d]", "" ) );
2013-12-29 00:54:44 +01:00
+ maxPermGen <<= 10 * ("kmg".indexOf( Character.toLowerCase( s.charAt( s.length() - 1 ) ) ) );
2013-12-23 04:08:28 +01:00
+ }
+ }
2013-12-29 00:54:44 +01:00
+ if ( maxPermGen < (128<<10) ) // 128mb
2013-12-23 04:08:28 +01:00
+ {
+ 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" );
+ }
+ // Spigot End
System.out.println("Loading libraries, please wait...");
MinecraftServer.main(options);
} catch (Throwable t) {
--
2013-12-29 00:54:44 +01:00
1.8.4.msysgit.0
2013-12-23 04:08:28 +01:00