/** Returns the maximum amount of memory available to ImageJ or zero if ImageJ is unable to determine this limit. */ public static long maxMemory() { if (maxMemory==0L) { Memory mem = new Memory(); maxMemory = mem.getMemorySetting(); if (maxMemory==0L) maxMemory = mem.maxMemory(); } return maxMemory; }
public void run(String arg) { changeMemoryAllocation(); //IJ.log("setting="+getMemorySetting()/(1024*1024)+"MB"); //IJ.log("maxMemory="+maxMemory()/(1024*1024)+"MB"); }
void changeMemoryAllocation() { int max = (int)(getMemorySetting()/1048576L); boolean unableToSet = max==0; if (max==0) max = (int)(maxMemory()/1048576L); String title = "Memory "+(IJ.is64Bit()?"(64-bit)":"(32-bit)"); GenericDialog gd = new GenericDialog(title); {showError(); return;} if (IJ.isMacOSX() && max2<256) max2 = 256;
public void run(String arg) { if (IJ.isMacOSX()) { // Unfortunately, ImageJ 1.x' Memory & Threads makes way too many assumptions to be // reused on MacOSX. A pity. runMacOSX(); return; } final File configFile = new File(FijiTools.getFijiDir(), "ImageJ.cfg"); if (!configFile.exists()) try { final PrintStream out = new PrintStream(new FileOutputStream(configFile)); out.println("."); out.println(IJ.isWindows() ? "jre\\bin\\javaw.exe" : "jre/bin/java"); out.println("-Xmx" +(maxMemory() >> 20) + "m -cp ij.jar ij.ImageJ"); out.close(); } catch (final IOException e) { IJ.error("Could not write initial ImageJ.cfg!"); return; } new ij.plugin.Memory().run(arg); }
public long getMemorySetting() { if (IJ.getApplet()!=null) return 0L; long max = 0L; if (IJ.isMacOSX()) { String appPath = System.getProperty("java.class.path"); if (appPath==null) return 0L; int index = appPath.indexOf(".app/"); if (index==-1) return 0L; appPath = appPath.substring(0,index+5); max = getMemorySetting(appPath+"Contents/Info.plist"); } else max = getMemorySetting("ImageJ.cfg"); return max; }
void showError() { int max = (int)(maxMemory()/1048576L); String msg = "ImageJ is unable to change the memory limit. For \n" + "more information, refer to the installation notes at\n \n" + " "+IJ.URL+"/docs/install/\n" + " \n"; if (fileMissing) { if (IJ.isMacOSX()) msg += "The ImageJ application (ImageJ.app) was not found.\n \n"; else if (IJ.isWindows()) msg += "ImageJ.cfg not found.\n \n"; fileMissing = false; } if (max>0) msg += "Current limit: " + max + "MB"; IJ.showMessage("Memory", msg); }
void changeMemoryAllocation() { int max = (int)(getMemorySetting()/1048576L); boolean unableToSet = max==0; if (max==0) max = (int)(maxMemory()/1048576L); String title = "Memory "+(IJ.is64Bit()?"(64-bit)":"(32-bit)"); GenericDialog gd = new GenericDialog(title); {showError(); return;} if (IJ.isMacOSX() && max2<256) max2 = 256;
public long getMemorySetting() { if (IJ.getApplet()!=null) return 0L; long max = 0L; if (IJ.isMacOSX()) { String appPath = System.getProperty("java.class.path"); if (appPath==null) return 0L; int index = appPath.indexOf(".app/"); if (index==-1) return 0L; appPath = appPath.substring(0,index+5); max = getMemorySetting(appPath+"Contents/Info.plist"); } else max = getMemorySetting("ImageJ.cfg"); return max; }
void showError() { int max = (int)(maxMemory()/1048576L); String msg = "ImageJ is unable to change the memory limit. For \n" + "more information, refer to the installation notes at\n \n" + " "+IJ.URL+"/docs/install/\n" + " \n"; if (fileMissing) { if (IJ.isMacOSX()) msg += "The ImageJ application (ImageJ.app) was not found.\n \n"; else if (IJ.isWindows()) msg += "ImageJ.cfg not found.\n \n"; fileMissing = false; } if (max>0) msg += "Current limit: " + max + "MB"; IJ.showMessage("Memory", msg); }
/** Returns the maximum amount of memory available to ImageJ or zero if ImageJ is unable to determine this limit. */ public static long maxMemory() { if (maxMemory==0L) { Memory mem = new Memory(); maxMemory = mem.getMemorySetting(); if (maxMemory==0L) maxMemory = mem.maxMemory(); } return maxMemory; }
public void run(String arg) { changeMemoryAllocation(); //IJ.log("setting="+getMemorySetting()/(1024*1024)+"MB"); //IJ.log("maxMemory="+maxMemory()/(1024*1024)+"MB"); }