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

shuwenwei pushed a commit to branch transferSchemaTreeInBatches
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/transferSchemaTreeInBatches by 
this push:
     new 861c6659009 modify MemoryEstimationHelper
861c6659009 is described below

commit 861c66590096d4082f57d2c7c37fb1ec7914ba1e
Author: shuwenwei <s13979062...@gmail.com>
AuthorDate: Fri Jul 25 12:34:38 2025 +0800

    modify MemoryEstimationHelper
---
 .../db/queryengine/execution/MemoryEstimationHelper.java   | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/MemoryEstimationHelper.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/MemoryEstimationHelper.java
index 39a98c80a12..8e68a31fc03 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/MemoryEstimationHelper.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/MemoryEstimationHelper.java
@@ -53,10 +53,20 @@ public class MemoryEstimationHelper {
 
   public static final long SHALLOW_SIZE_OF_HASHMAP =
       RamUsageEstimator.shallowSizeOfInstance(HashMap.class);
-  public static final long SHALLOW_SIZE_OF_HASHMAP_ENTRY = 32;
+  public static long SHALLOW_SIZE_OF_HASHMAP_ENTRY;
   public static final long SHALLOW_SIZE_OF_CONCURRENT_HASHMAP =
       RamUsageEstimator.shallowSizeOfInstance(ConcurrentHashMap.class);
-  public static final long SHALLOW_SIZE_OF_CONCURRENT_HASHMAP_ENTRY = 24;
+  public static long SHALLOW_SIZE_OF_CONCURRENT_HASHMAP_ENTRY;
+
+  static {
+    Map<Integer, Integer> map = new HashMap<>(1);
+    map.put(1, 1);
+    Map.Entry<Integer, Integer> next = map.entrySet().iterator().next();
+    SHALLOW_SIZE_OF_HASHMAP_ENTRY = RamUsageEstimator.shallowSizeOf(next);
+    map = new ConcurrentHashMap<>(map);
+    SHALLOW_SIZE_OF_CONCURRENT_HASHMAP_ENTRY =
+        RamUsageEstimator.shallowSizeOf(map.entrySet().iterator().next());
+  }
 
   private MemoryEstimationHelper() {
     // hide the constructor

Reply via email to