public static long getDirectUsedMemoryBytes() {
    return ManagementFactory.getPlatformMXBeans(BufferPoolMXBean.class).stream()
      .filter(pool -> "direct".equals(pool.getName()))
      .mapToLong(BufferPoolMXBean::getTotalCapacity)
      .sum();
  }
Returns the amount of direct memory (allocated through {@link java.nio.ByteBuffer#allocateDirect(int)}) used by the
JVM.
planetiler-core/src/main/java/com/onthegomap/planetiler/stats/ProcessInfo.java