@SuppressWarnings("java:S3518")
  private void initStorageEngineAllocate(
      MemoryManager storageEngineMemoryManager, TrimProperties properties) {
    final double rejectProportion =
        Double.parseDouble(
            properties.getProperty("reject_proportion", Double.toString(getRejectProportion())));
    final double walBufferQueueProportion =
        Double.parseDouble(
            properties.getProperty(
                "wal_buffer_queue_proportion", Double.toString(getWalBufferQueueProportion())));
    final double devicePathCacheProportion =
        Double.parseDouble(
            properties.getProperty(
                "device_path_cache_proportion", Double.toString(getDevicePathCacheProportion())));

    if (rejectProportion + walBufferQueueProportion + devicePathCacheProportion >= 1) {
      LOGGER.warn(
          "The sum of reject_proportion, wal_buffer_queue_proportion and device_path_cache_proportion is too large, use default values 0.8, 0.1 and 0.05.");
    } else {
      setRejectProportion(rejectProportion);
      setWalBufferQueueProportion(walBufferQueueProportion);
      setDevicePathCacheProportion(devicePathCacheProportion);
    }

    setBufferedArraysMemoryProportion(
        Double.parseDouble(
            properties.getProperty(
                "buffered_arrays_memory_proportion",
                Double.toString(getBufferedArraysMemoryProportion()))));

    long storageMemoryTotal = storageEngineMemoryManager.getTotalMemorySizeInBytes();
    String valueOfStorageEngineMemoryProportion =
        properties.getProperty("storage_engine_memory_proportion");
    long writeMemorySize = storageMemoryTotal * 8 / 10;
    long compactionMemorySize = storageMemoryTotal * 2 / 10;
    long memtableMemorySize = writeMemorySize * 19 / 20;
    long timePartitionInfoMemorySize = writeMemorySize / 20;
    if (valueOfStorageEngineMemoryProportion != null) {
      String[] storageProportionArray = valueOfStorageEngineMemoryProportion.split(":");
      int storageEngineMemoryProportion = 0;
      for (String proportion : storageProportionArray) {
        int proportionValue = Integer.parseInt(proportion.trim());
        if (proportionValue <= 0) {
          LOGGER.warn(
              "The value of storage_engine_memory_proportion is illegal, use default value 8:2 .");
          return;
        }
        storageEngineMemoryProportion += proportionValue;
      }
      writeMemorySize =
          storageMemoryTotal
              * Integer.parseInt(storageProportionArray[0].trim())
              / storageEngineMemoryProportion;
      compactionMemorySize =
          storageMemoryTotal
              * Integer.parseInt(storageProportionArray[1].trim())
              / storageEngineMemoryProportion;

      String valueOfWriteMemoryProportion = properties.getProperty("write_memory_proportion");
      if (valueOfWriteMemoryProportion != null) {
        String[] writeProportionArray = valueOfWriteMemoryProportion.split(":");
        int writeMemoryProportion = 0;
        for (String proportion : writeProportionArray) {
          int proportionValue = Integer.parseInt(proportion.trim());
          writeMemoryProportion += proportionValue;
          if (proportionValue <= 0) {
            LOGGER.warn(
                "The value of write_memory_proportion is illegal, use default value 19:1 .");
            return;
          }
        }

        memtableMemorySize =
            writeMemorySize
                * Integer.parseInt(writeProportionArray[0].trim())
                / writeMemoryProportion;
        timePartitionInfoMemorySize =
            writeMemorySize
                * Integer.parseInt(writeProportionArray[1].trim())
                / writeMemoryProportion;
      }
    }
    writeMemoryManager =
        storageEngineMemoryManager.getOrCreateMemoryManager("Write", writeMemorySize);
    initCompactionMemoryManager(compactionMemorySize);
    memtableMemoryManager =
        writeMemoryManager.getOrCreateMemoryManager("Memtable", memtableMemorySize);
    timePartitionInfoMemoryManager =
        writeMemoryManager.getOrCreateMemoryManager(
            "TimePartitionInfo", timePartitionInfoMemorySize);
    long devicePathCacheMemorySize = (long) (memtableMemorySize * getDevicePathCacheProportion());
    devicePathCacheMemoryManager =
        memtableMemoryManager.getOrCreateMemoryManager(
            "DevicePathCache", devicePathCacheMemorySize);
    long bufferedArraysMemorySize =
        (long) (storageMemoryTotal * getBufferedArraysMemoryProportion());
    bufferedArraysMemoryManager =
        memtableMemoryManager.getOrCreateMemoryManager("BufferedArray", bufferedArraysMemorySize);
    long walBufferQueueMemorySize = (long) (memtableMemorySize * getWalBufferQueueProportion());
    walBufferQueueMemoryManager =
        memtableMemoryManager.getOrCreateMemoryManager("WalBufferQueue", walBufferQueueMemorySize);
  }
The memory manager of direct Buffer
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/conf/DataNodeMemoryConfig.java