Class RuntimeMemory

java.lang.Object
io.deephaven.engine.table.impl.util.RuntimeMemory

public class RuntimeMemory extends Object
Cache memory utilization.

Calling Runtime.getRuntime().freeMemory() is expensive; and we may do it a lot when we have automatically computed tables, such as in a partitionBy. Instead of calling the runtime directly from the performance instrumentation framework, we call this class's methods; which cache the result for a configurable number of milliseconds to avoid repeated calls that are not likely any different.

Additionally, we log our JVM heap usage on a regular basis; to enable users to quickly examine their worker logs and understand memory issues.

  • Method Details

    • getInstance

      public static RuntimeMemory getInstance()
      Return a singleton RuntimeMemory object.
      Returns:
      the RuntimeMemory singleton
    • read

      public void read(RuntimeMemory.Sample buf)
      Read last collected samples. Triggers a new snapshot if the last snapshot is older than cacheInterval.
      Parameters:
      buf - a user provided buffer object to store the samples.
    • readOnly

      public void readOnly(RuntimeMemory.Sample buf)
      Read last collected samples.
      Parameters:
      buf - a user provided buffer object to store the samples.
    • maxMemory

      public long maxMemory()