public static void checkForClusterFreeHeapMemoryLimit(Configuration conf) {
    if (conf.get(MEMSTORE_SIZE_OLD_KEY) != null) {
      LOG.warn(MEMSTORE_SIZE_OLD_KEY + " is deprecated by " + MEMSTORE_SIZE_KEY);
    }
    float globalMemstoreSize = getGlobalMemStoreHeapPercent(conf, false);
    int gml = (int) (globalMemstoreSize * CONVERT_TO_PERCENTAGE);
    float blockCacheUpperLimit = getBlockCacheHeapPercent(conf);
    int bcul = (int) (blockCacheUpperLimit * CONVERT_TO_PERCENTAGE);
    if (
      CONVERT_TO_PERCENTAGE - (gml + bcul)
          < (int) (CONVERT_TO_PERCENTAGE * HConstants.HBASE_CLUSTER_MINIMUM_MEMORY_THRESHOLD)
    ) {
      throw new RuntimeException("Current heap configuration for MemStore and BlockCache exceeds "
        + "the threshold required for successful cluster operation. "
        + "The combined value cannot exceed 0.8. Please check " + "the settings for "
        + MEMSTORE_SIZE_KEY + " and either " + HConstants.HFILE_BLOCK_CACHE_MEMORY_SIZE_KEY + " or "
        + HConstants.HFILE_BLOCK_CACHE_SIZE_KEY + " in your configuration. " + MEMSTORE_SIZE_KEY
        + "=" + globalMemstoreSize + ", " + HConstants.HFILE_BLOCK_CACHE_MEMORY_SIZE_KEY + "="
        + conf.get(HConstants.HFILE_BLOCK_CACHE_MEMORY_SIZE_KEY) + ", "
        + HConstants.HFILE_BLOCK_CACHE_SIZE_KEY + "="
        + conf.get(HConstants.HFILE_BLOCK_CACHE_SIZE_KEY) + ". (Note: If both "
        + HConstants.HFILE_BLOCK_CACHE_MEMORY_SIZE_KEY + " and "
        + HConstants.HFILE_BLOCK_CACHE_SIZE_KEY + " are set, " + "the system will use "
        + HConstants.HFILE_BLOCK_CACHE_MEMORY_SIZE_KEY + ")");
    }
  }
Checks whether we have enough heap memory left out after portion for Memstore and Block cache.
We need atleast 20% of heap left out for other RS functions.
hbase-server/src/main/java/org/apache/hadoop/hbase/io/util/MemorySizeUtil.java