2014-03-23 01:20:02 +01:00
From 4f38a35da6cf609f852bae50e5b9102c21f71ddf 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
2014-03-23 01:20:02 +01:00
index 8d127fb..008e037 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
2014-02-12 14:48:26 +01:00
@@ -155,6 +155,22 @@ 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
+ }
+ }
2014-03-23 01:20:02 +01:00
+ if ( Float.parseFloat( System.getProperty( "java.class.version" ) ) < 52 && 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" );
2014-01-28 18:51:26 +01:00
+ System.out.println( "Please see http://www.spigotmc.org/wiki/changing-permgen-size/ for more details and more in-depth instructions." );
2013-12-23 04:08:28 +01:00
+ }
+ // Spigot End
System.out.println("Loading libraries, please wait...");
MinecraftServer.main(options);
} catch (Throwable t) {
--
2014-03-09 22:37:28 +01:00
1.8.3.2
2013-12-23 04:08:28 +01:00