Enable mmap of files (default is not enabled) if JVM is 64bits, call before use {@link #open()}
4358
public void enableMmapIfSupported() {
		if (validState) {
			throw new InvalidStateException();
		}
		useMmap = Check64bitsJVM.JVMis64bits();
		if (useMmap) {
			log.info("Enabled mmap on 64bits JVM");
		} else {
			log.info("Disabled mmap on 32bits JVM");
		}
	}
143922
function enable(path) {
        var result = new $.Deferred(),
            file = FileSystem.getFileForPath(path + "/.disabled");

        function afterEnable() {
            ExtensionLoader.loadExtension(FileUtils.getBaseName(path), { baseUrl: path }, "main")
                .done(result.resolve)
                .fail(result.reject);
        }

        var defaultExtensionPath = ExtensionLoader.getDefaultExtensionPath();
        if (file.fullPath.indexOf(defaultExtensionPath) === 0) {
            toggleDefaultExtension(path, true);
            afterEnable();
            return result.promise();
        }

        file.unlink(function (err) {
            if (err) {
                return result.reject(err);
            }
            afterEnable();
        });
        return result.promise();
    }
843451
private static function check_64_bit()
    {
        if (8 != PHP_INT_SIZE)
            if (extension_loaded('gmp'))
                self::$biginteger_mode = self::GMP_BIGINTEGER_MODE;
            else
                throw new Exception('This platform cannot handle a 64-bit operations. '
                    . 'Please install the GMP PHP extension.');
        else
            self::$biginteger_mode = self::PHP_BIGINTEGER_MODE;

    }
1234791
private InputStream safeOpen(String file) {
    URL url = bundle.getEntry(file);
    if (url != null) {
      try {
        return url.openStream();
      } catch (IOException e) {
        // if we get an IOException just return null for default page.
      }
    }
    return null;
  }
191450
static Jvm of(final Path javaHome) {
        if (javaHome == null || javaHome.equals(JAVA_HOME)) {
            return DEFAULT;
        }
        final Path path = validateJavaHome(javaHome);
        return new Jvm(path, isModularJavaHome(path));
    }
568269
protected void openFile() {

        try {
            FileAccess   fa  = isDump ? FileUtil.getDefaultInstance()
                                      : database.getFileAccess();
            OutputStream fos = fa.openOutputStreamElement(outFile);

            outDescriptor = fa.getFileSync(fos);
            fileStreamOut = new BufferedOutputStream(fos, 2 << 12);
        } catch (IOException e) {
            throw Error.error(ErrorCode.FILE_IO_ERROR,
                              ErrorCode.M_Message_Pair, new Object[] {
                e.toString(), outFile
            });
        }
    }
1296625
public function fopen($filename, $mode, $use_include_path = null, $context = null) {

        if ($mode !== self::MODE_READ_BINARY) {
            $message = sprintf(
                "unsupported mode '%s', only '%s' is supported for buffered file read", $mode, self::MODE_READ_BINARY
            );
            trigger_error($message);

            return false;
        }

        if ($context === null) {
            $handle = fopen($filename, self::MODE_READ_BINARY, $use_include_path);
        } else {
            $handle = fopen($filename, self::MODE_READ_BINARY, $use_include_path, $context);
        }

        if (!$handle) {
            return false;
        }

        $this->file   = $filename;
        $this->handle = $handle;

        return true;
    }
651853
public void openImageSet(String ...files ) {
		synchronized (lockStartingProcess) {
			if( startingProcess ) {
				System.out.println("Ignoring open image set request.  Detected spamming");
				return;
			}
			startingProcess = true;
		}

		stopAllInputProcessing();

		synchronized (inputStreams) {
			inputMethod = InputMethod.IMAGE_SET;
			inputFileSet = files;
			if( threadProcess != null )
				throw new RuntimeException("There is still an active stream thread!");
			threadProcess = new ProcessImageSetThread(files);
			imageSetSize = files.length;
		}
		threadPool.execute(threadProcess);
	}
297735
public static void enable() {
        final MetaClassRegistry metaClassRegistry = GroovySystem.getMetaClassRegistry();
        synchronized (metaClassRegistry) {
            if (metaClassRegistry.getMetaClassCreationHandler() != instance) {
                ClassInfo.clearModifiedExpandos();
                metaClassRegistry.setMetaClassCreationHandle(instance);
            }
        }
    }
817484
private void readMbean() {
		if (clazz == null) {
			return;
		}
		try {
			if (isUnixOS) {
				long openFiles = getValue("OpenFileDescriptorCount");
				long maxOpenFiles = getValue("MaxFileDescriptorCount");

				long freePhysicalMemorySize = getValue("FreePhysicalMemorySize");
				long totalPhysicalMemorySize = getValue("TotalPhysicalMemorySize");

				long processTime = getValue("ProcessCpuTime");

				double processCPULoad = getDoubleValue("ProcessCpuLoad");
				double systemCPULoad = getDoubleValue("SystemCpuLoad");

				long processors = getValue("AvailableProcessors");

				stats.update((int) openFiles, (int) maxOpenFiles, freePhysicalMemorySize, totalPhysicalMemorySize, processTime, (int) processors, processCPULoad, systemCPULoad);

			} else if (isWindowsOS) {
				long processors = getValue("AvailableProcessors");
				double systemCPULoad = readWindowsCPULoad();

				long totalPhysicalMemorySize = readWindowsTotalMemory();
				long freePhysicalMemorySize = readWindowsFreeMemory();

				stats.update(-1, -1, freePhysicalMemorySize, totalPhysicalMemorySize, -1, (int) processors, -1, systemCPULoad);

			} else {
				long processors = getValue("AvailableProcessors");

				stats.update(-1, -1, -1, -1, -1, (int) processors, -1, -1);
			}

		} catch (Exception e) {
			log.warn("Couldn't read value due to", e);
		}
	}
699393
public void enable() throws IOException {
        if (!disableFile.exists()) {
            LOGGER.log(Level.FINEST, "Plugin {0} has been already enabled. Skipping the enable() operation", getShortName());
            return;
        }
        if(!disableFile.delete())
            throw new IOException("Failed to delete "+disableFile);
    }
1188333
def _to_memory_mode(self):
        """"""
        self._adata.__X = self._adata.X[()]
        self._file.close()
        self._file = None
        self._filename = None
1077552
public boolean canSystemGrantMemory(final long xmx) {
    final long freeMemSize = this.util.getOsTotalFreeMemorySize();
    if (freeMemSize == 0) {
      // Fail open.
      // On the platforms that don't support the mem info file, the returned size will be 0.
      return true;
    }
    if (freeMemSize - xmx < LOW_MEM_THRESHOLD) {
      logger.info(String.format(
          "Free memory amount minus Xmx (%d - %d kb) is less than low mem threshold (%d kb), "
              + "memory request declined.",
          freeMemSize, xmx, LOW_MEM_THRESHOLD));
      return false;
    }
    return true;
  }
752103
@Override
    protected void ensureAvailableBytes(int size)
    {
        if (offset + size > bufferSize)
        {
            try
            {
                int availableBytes = (int) (fileChannel.size() - fileChannel.position());
                ByteBuffer byteBuffer = ByteBuffer.allocate(Math.min(availableBytes, offset));
                int readBytes = fileChannel.read(byteBuffer);
                if (readBytes == availableBytes)
                {
                    fileChannel.close();
                    fileChannel = null;
                }
                assert readBytes > 0 : "已到达文件尾部！";
                byteBuffer.flip();
                byte[] bytes = byteBuffer.array();
                System.arraycopy(this.bytes, offset, this.bytes, offset - readBytes, bufferSize - offset);
                System.arraycopy(bytes, 0, this.bytes, bufferSize - readBytes, readBytes);
                offset -= readBytes;
            }
            catch (IOException e)
            {
                throw new RuntimeException(e);
            }
        }
    }
758276
public static function enable()
    {
        self::$startValues = array(
            'time' => microtime(true),
            'realmem' => memory_get_usage(true),
            // 'emalloc' => memory_get_usage(false)
        );
        self::$_enabled = true;
    }
78293
static boolean isCharsetSupported() throws IOException {
    try {
      ZipFile.class.getConstructor(new Class[] { File.class, Charset.class });
      return true;
    }
    catch (NoSuchMethodException e) {
      return false;
    }
  }
395651
public static Integer getOpenFileLimit() {
        try {
            Rlimit rlimit = new Rlimit();
            int retval =
                getrlimit(
                    System.getProperty("os.name").equals("Linux") ? RLIMIT_NOFILE_LINUX : RLIMIT_NOFILE_MAC_OS_X,
                            rlimit);
            if (retval != 0) {
                return null;
            } else if (rlimit.rlim_cur >= 1024) {
                //Seems to be a sensible value that is the default or greater
                return (int)rlimit.rlim_cur;
            } else {
                return null;
            }
        } catch (Exception e) {
            hostLog.warn("Failed to retrieve open file limit via JNA", e);
        }
        return null;
    }