Index: applications/editors/josm/plugins/restart/src/josmrestartplugin/RestartJosmAction.java
===================================================================
--- applications/editors/josm/plugins/restart/src/josmrestartplugin/RestartJosmAction.java	(revision 27852)
+++ applications/editors/josm/plugins/restart/src/josmrestartplugin/RestartJosmAction.java	(revision 28438)
@@ -6,4 +6,6 @@
 import java.awt.event.KeyEvent;
 import java.io.File;
+import java.lang.management.ManagementFactory;
+import java.util.LinkedList;
 
 import org.openstreetmap.josm.Main;
@@ -28,18 +30,16 @@
         try {
             File jarfile = new File(Main.class.getProtectionDomain().getCodeSource().getLocation().toURI());
-            long memmax = Runtime.getRuntime().maxMemory();
             String javacmd = "java";
             if (Main.platform instanceof PlatformHookWindows) javacmd = "javaw";
-            String[] cmds = new String[] {
-                    javacmd,
-                    "-Xmx" + memmax,
-                    "-jar",
-                    jarfile.getAbsolutePath()
-            };
+            LinkedList<String> cmds = new LinkedList<String>();
+            cmds.add(javacmd);
+            cmds.addAll(ManagementFactory.getRuntimeMXBean().getInputArguments());
+            cmds.add("-jar");
+            cmds.add(jarfile.getAbsolutePath());
             for (String s : cmds)
                 System.out.print(s + " ");
             System.out.println();
 
-            Runtime.getRuntime().exec(cmds);
+            Runtime.getRuntime().exec(cmds.toArray(new String[0]));
         } catch (Exception e) {
             e.printStackTrace();
