This is an automated email from the ASF dual-hosted git repository.

Wei-hao-Li pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git

commit d1f2ee823f9abb5446f4173f1c2c85318d67a55a
Author: Weihao Li <[email protected]>
AuthorDate: Thu Apr 30 11:22:06 2026 +0800

    modify release
    
    Signed-off-by: Weihao Li <[email protected]>
---
 .../apache/iotdb/commons/memory/AtomicLongMemoryBlock.java | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git 
a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/memory/AtomicLongMemoryBlock.java
 
b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/memory/AtomicLongMemoryBlock.java
index 1a7d3c25413..7f144e5d0d6 100644
--- 
a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/memory/AtomicLongMemoryBlock.java
+++ 
b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/memory/AtomicLongMemoryBlock.java
@@ -104,15 +104,13 @@ public class AtomicLongMemoryBlock extends IMemoryBlock {
     long next;
     do {
       prev = usedMemoryInBytes.get();
-      if (sizeInByte > prev) {
-        LOGGER.warn(
-            "The memory cost to be released is larger than the memory cost of 
memory block {}",
-            this);
-        next = 0;
-      } else {
-        next = prev - sizeInByte;
-      }
+      next = sizeInByte > prev ? 0 : prev - sizeInByte;
     } while (!usedMemoryInBytes.compareAndSet(prev, next));
+    if (sizeInByte > prev) {
+      // print log after compareAndSet was success
+      LOGGER.warn(
+          "The memory cost to be released is larger than the memory cost of 
memory block {}", this);
+    }
     return next;
   }
 

Reply via email to