int () { //final JpsProject project = context.getProjectDescriptor().getProject(); //final JpsJavaCompilerConfiguration config = JpsJavaExtensionService.getInstance().getOrCreateCompilerConfiguration(project); //final JpsJavaCompilerOptions options = config.getCurrentCompilerOptions(); //return options.MAXIMUM_HEAP_SIZE; if (FORKED_JAVAC_HEAP_SIZE_MB > 0) { return FORKED_JAVAC_HEAP_SIZE_MB; } final int maxMbytes = (int)(Runtime.getRuntime().maxMemory() / 1048576L); if (maxMbytes < 0 || maxMbytes > 1500) { return -1; // in the size is too big for older VMs or int overflow, return -1 to let VM choose the heap size } return Math.max(maxMbytes, 256); // per-forked process: minimum 256 Mb }