private IMemoryBlock getOrRegisterMemoryBlock(
      String name, long sizeInBytes, MemoryBlockType type) {
    if (sizeInBytes < 0) {
      throw new MemoryException(
          String.format(
              "register memory block %s failed: sizeInBytes should be non-negative", name));
    }
    return allocatedMemoryBlocks.compute(
        name,
        (blockName, block) -> {
          if (block != null) {
            if (block.getTotalMemorySizeInBytes() != sizeInBytes) {
              LOGGER.warn(
                  "getOrRegisterMemoryBlock failed: memory block {} already exists, "
                      + "it's size is {}, requested size is {}",
                  blockName,
                  block.getTotalMemorySizeInBytes(),
                  sizeInBytes);
            }
            return block;
          } else {
            allocatedMemorySizeInBytes += sizeInBytes;
            return new AtomicLongMemoryBlock(name, this, sizeInBytes, type);
          }
        });
  }
Try to register memory block with specified size in bytes

@param name the name of memory block, UNIQUE
@param sizeInBytes the size in bytes of memory block
@param type the type of memory block
@return the memory block
iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/memory/MemoryManager.java