public long estimateCrossCompactionMemory(
      List<TsFileResource> seqResources, List<TsFileResource> unseqResources) throws IOException {
    List<TsFileResource> resources = new ArrayList<>(seqResources.size() + unseqResources.size());
    resources.addAll(seqResources);
    resources.addAll(unseqResources);
    CompactionEstimateUtils.addReadLock(resources);

    long cost = 0;
    try {
      CompactionTaskInfo taskInfo = calculatingCompactionTaskInfo(resources);
      cost += calculatingMetadataMemoryCost(taskInfo);
      cost += calculatingDataMemoryCost(taskInfo);
    } finally {
      CompactionEstimateUtils.releaseReadLock(resources);
    }
    return cost;
  }
Estimate the memory cost of one cross space compaction task with specific source files based on
its corresponding implementation.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/selector/estimator/AbstractCrossSpaceEstimator.java