@Override
  public void remove(ICachedMNode node) {
    CacheEntry cacheEntry = node.getCacheEntry();
    synchronized (cacheEntry) {
      if (cacheEntry.hasVolatileDescendant()) {
        throw new IllegalStateException(
            String.format(
                "There should not exist descendant under this node %s", node.getFullPath()));
      }
      if (cacheEntry.isVolatile()) {
        addAncestorsToCache(node);
        memoryStatistics.removeVolatileNode();
        if (!getCacheEntry(node.getParent()).hasVolatileDescendant()) {
          nodeBuffer.remove(getCacheEntry(node.getParent()));
        }
      } else {
        nodeCache.removeFromNodeCache(cacheEntry);
      }

      node.setCacheEntry(null);
    }

    if (cacheEntry.isPinned()) {
      memoryStatistics.releasePinnedMemResource(node);
    }
    memoryStatistics.releaseMemResource(node);
  }
When this method is invoked, it should be guaranteed that the target node has no descendent.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/pbtree/memory/MemoryManager.java