docs: private static long initMemoryLimit(final ResultOutput resultOutput)
    {
      // default setting
      long memoryLimit = SessionUtil.DEFAULT_CLIENT_MEMORY_LIMIT * 1024 * 1024;
      if (resultOutput.parameters.get(CLIENT_MEMORY_LIMIT) != null)
      {
        // use the settings from the customer
        memoryLimit =
            (int) resultOutput.parameters.get(CLIENT_MEMORY_LIMIT) * 1024L * 1024L;
      }
  
      long maxMemoryToUse = Runtime.getRuntime().maxMemory() * 8 / 10;
      if ((int) resultOutput.parameters.get(CLIENT_MEMORY_LIMIT)
          == SessionUtil.DEFAULT_CLIENT_MEMORY_LIMIT)
      {
        // if the memory limit is the default value and best effort memory is enabled
        // set the memory limit to 80% of the maximum as the best effort
        memoryLimit = Math.max(memoryLimit, maxMemoryToUse);
      }
  
      // always make sure memoryLimit <= 80% of the maximum
      memoryLimit = Math.min(memoryLimit, maxMemoryToUse);
  
      logger.debug("Set allowed memory usage to {} bytes", memoryLimit);
      return memoryLimit;
    }