code: @Override
      protected EnvironmentConfig createEnvConfig() {
          EnvironmentConfig envConf = new EnvironmentConfig();
          envConf.setAllowCreate(true);
          envConf.setTransactional(true);
  
          LOGGER.log(Level.FINE, "Calculating cache size");
          MemoryMXBean memoryMXBean = ManagementFactory.getMemoryMXBean();
          MemoryUsage memoryUsage = memoryMXBean.getHeapMemoryUsage();
          long max = memoryUsage.getMax();
          long used = memoryUsage.getUsed();
          long available = max - used;
          long cacheSize = Math.round(available / 6.0);
          envConf.setCacheSize(cacheSize);
          LOGGER.log(Level.FINE, "Cache size set to {0}", cacheSize);
          return envConf;
      }
docs: Creates an environment config that allows object creation and supports
  transactions. In addition, it automatically calculates a cache size
  based on available memory.
  
  @return a newly created environment config instance.