docs: static void checkHeapMemCapacity(final int k, final long n, final boolean compact,
                                     final int serVer, final long memCapBytes) {
      final int metaPre = Family.QUANTILES.getMaxPreLongs() + ((serVer == 1) ? 3 : 2);
      final int retainedItems = computeRetainedItems(k, n);
      final int reqBufBytes;
      if (compact) {
        reqBufBytes = (metaPre + retainedItems) << 3;
      } else { //not compact
        final int totLevels = Util.computeNumLevelsNeeded(k, n);
        reqBufBytes = (totLevels == 0)
            ? (metaPre + retainedItems) << 3
            : (metaPre + ((2 + totLevels) * k)) << 3;
      }
      if (memCapBytes < reqBufBytes) {
        throw new SketchesArgumentException("Possible corruption: Memory capacity too small: "
            + memCapBytes + " < " + reqBufBytes);
      }
    }