You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ro...@apache.org on 2021/08/18 04:07:19 UTC

[iotdb] branch master updated: PrimitiveArrayManager: make POOLED_ARRAYS_MEMORY_THRESHOLD smaller than its actual allowed value (#3775)

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

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


The following commit(s) were added to refs/heads/master by this push:
     new cebab26  PrimitiveArrayManager: make POOLED_ARRAYS_MEMORY_THRESHOLD smaller than its actual allowed value (#3775)
cebab26 is described below

commit cebab266f92562c333fbcbb4e28078935831bc91
Author: Steve Yurong Su (宇荣) <ro...@apache.org>
AuthorDate: Tue Aug 17 23:06:55 2021 -0500

    PrimitiveArrayManager: make POOLED_ARRAYS_MEMORY_THRESHOLD smaller than its actual allowed value (#3775)
---
 .../java/org/apache/iotdb/db/rescon/PrimitiveArrayManager.java | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/server/src/main/java/org/apache/iotdb/db/rescon/PrimitiveArrayManager.java b/server/src/main/java/org/apache/iotdb/db/rescon/PrimitiveArrayManager.java
index 0fd0524..e829c1b 100644
--- a/server/src/main/java/org/apache/iotdb/db/rescon/PrimitiveArrayManager.java
+++ b/server/src/main/java/org/apache/iotdb/db/rescon/PrimitiveArrayManager.java
@@ -40,9 +40,17 @@ public class PrimitiveArrayManager {
 
   public static final int ARRAY_SIZE = CONFIG.getPrimitiveArraySize();
 
+  /**
+   * The actual used memory will be 50% larger than the statistic, so we need to limit the size of
+   * POOLED_ARRAYS_MEMORY_THRESHOLD, make it smaller than its actual allowed value.
+   */
+  private static final double AMPLIFICATION_FACTOR = 1.5;
+
   /** threshold total size of arrays for all data types */
   private static final double POOLED_ARRAYS_MEMORY_THRESHOLD =
-      CONFIG.getAllocateMemoryForWrite() * CONFIG.getBufferedArraysMemoryProportion();
+      CONFIG.getAllocateMemoryForWrite()
+          * CONFIG.getBufferedArraysMemoryProportion()
+          / AMPLIFICATION_FACTOR;
 
   /** TSDataType#serialize() -> ArrayDeque<Array>, VECTOR is ignored */
   private static final ArrayDeque[] POOLED_ARRAYS = new ArrayDeque[TSDataType.values().length - 1];