/** Creates the database. */
  public Database(Path dir) {
    Environment.addClassLoaderListener(new CloseListener(this));

    _lifecycle.setName(toString());

    if (dir != null) setPath(dir);

    _blockManager = BlockManager.create();
  }
  /**
   * Ensure a minimum memory size.
   *
   * @param minCapacity the minimum capacity in bytes
   */
  public void ensureMemoryCapacity(long minCapacity) {
    int minBlocks = (int) ((minCapacity + BlockStore.BLOCK_SIZE - 1) / BlockStore.BLOCK_SIZE);

    _blockManager.ensureCapacity(minBlocks);
  }