public void init(TrimProperties properties) {
    // on heap memory
    String memoryAllocateProportion = properties.getProperty("datanode_memory_proportion", null);
    // Get global memory manager here
    if (memoryAllocateProportion == null) {
      memoryAllocateProportion =
          properties.getProperty("storage_query_schema_consensus_free_memory_proportion");
      if (memoryAllocateProportion != null) {
        LOGGER.warn(
            "The parameter storage_query_schema_consensus_free_memory_proportion is deprecated since v1.2.3, "
                + "please use datanode_memory_proportion instead.");
      }
    }

    long storageEngineMemorySize = Runtime.getRuntime().maxMemory() * 3 / 10;
    long queryEngineMemorySize = Runtime.getRuntime().maxMemory() * 3 / 10;
    long schemaEngineMemorySize = Runtime.getRuntime().maxMemory() / 10;
    long consensusMemorySize = Runtime.getRuntime().maxMemory() / 10;
    long pipeMemorySize = Runtime.getRuntime().maxMemory() / 10;
    if (memoryAllocateProportion != null) {
      String[] proportions = memoryAllocateProportion.split(":");
      int proportionSum = 0;
      for (String proportion : proportions) {
        proportionSum += Integer.parseInt(proportion.trim());
      }
      long maxMemoryAvailable = Runtime.getRuntime().maxMemory();

      if (proportionSum != 0) {
        storageEngineMemorySize =
            maxMemoryAvailable * Integer.parseInt(proportions[0].trim()) / proportionSum;
        queryEngineMemorySize =
            maxMemoryAvailable * Integer.parseInt(proportions[1].trim()) / proportionSum;
        schemaEngineMemorySize =
            maxMemoryAvailable * Integer.parseInt(proportions[2].trim()) / proportionSum;
        consensusMemorySize =
            maxMemoryAvailable * Integer.parseInt(proportions[3].trim()) / proportionSum;
        // if pipe proportion is set, use it, otherwise use the default value
        if (proportions.length >= 6) {
          pipeMemorySize =
              maxMemoryAvailable * Integer.parseInt(proportions[4].trim()) / proportionSum;
        } else {
          pipeMemorySize =
              (maxMemoryAvailable
                      - storageEngineMemorySize
                      + queryEngineMemorySize
                      + schemaEngineMemorySize
                      + consensusMemorySize)
                  / 2;
        }
      }
    }
    onHeapMemoryManager =
        MemoryConfig.global().getOrCreateMemoryManager("OnHeap", Runtime.getRuntime().maxMemory());
    storageEngineMemoryManager =
        onHeapMemoryManager.getOrCreateMemoryManager("StorageEngine", storageEngineMemorySize);
    queryEngineMemoryManager =
        onHeapMemoryManager.getOrCreateMemoryManager("QueryEngine", queryEngineMemorySize);
    schemaEngineMemoryManager =
        onHeapMemoryManager.getOrCreateMemoryManager("SchemaEngine", schemaEngineMemorySize);
    consensusMemoryManager =
        onHeapMemoryManager.getOrCreateMemoryManager("Consensus", consensusMemorySize);
    pipeMemoryManager = onHeapMemoryManager.getOrCreateMemoryManager("Pipe", pipeMemorySize);
    LOGGER.info(
        "initial allocateMemoryForWrite = {}",
        storageEngineMemoryManager.getTotalMemorySizeInBytes());
    LOGGER.info(
        "initial allocateMemoryForRead = {}", queryEngineMemoryManager.getTotalMemorySizeInBytes());
    LOGGER.info(
        "initial allocateMemoryForSchema = {}",
        schemaEngineMemoryManager.getTotalMemorySizeInBytes());
    LOGGER.info(
        "initial allocateMemoryForConsensus = {}",
        consensusMemoryManager.getTotalMemorySizeInBytes());
    LOGGER.info(
        "initial allocateMemoryForPipe = {}", pipeMemoryManager.getTotalMemorySizeInBytes());

    initSchemaMemoryAllocate(schemaEngineMemoryManager, properties);
    initStorageEngineAllocate(storageEngineMemoryManager, properties);
    initQueryEngineMemoryAllocate(queryEngineMemoryManager, properties);

    String offHeapMemoryStr = System.getProperty("OFF_HEAP_MEMORY");
    offHeapMemoryManager =
        MemoryConfig.global()
            .getOrCreateMemoryManager("OffHeap", MemUtils.strToBytesCnt(offHeapMemoryStr), false);

    // when we can't get the OffHeapMemory variable from environment, it will be 0
    // and the limit should not be effective
    long totalDirectBufferMemorySizeLimit =
        offHeapMemoryManager.getTotalMemorySizeInBytes() == 0
            ? Long.MAX_VALUE
            : (long)
                (offHeapMemoryManager.getTotalMemorySizeInBytes()
                    * getMaxDirectBufferOffHeapMemorySizeProportion());
    directBufferMemoryManager =
        offHeapMemoryManager.getOrCreateMemoryManager(
            "DirectBuffer", totalDirectBufferMemorySizeLimit);
  }
The memory manager of direct Buffer
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/conf/DataNodeMemoryConfig.java