You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ji...@apache.org on 2019/04/12 14:34:33 UTC

[incubator-iotdb] branch refactor_mem_control updated: fix an unproperly initialized var

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

jiangtian pushed a commit to branch refactor_mem_control
in repository https://gitbox.apache.org/repos/asf/incubator-iotdb.git


The following commit(s) were added to refs/heads/refactor_mem_control by this push:
     new 1559cd5  fix an unproperly initialized var
1559cd5 is described below

commit 1559cd56b08419ba8993b0e2d209cc1f7e861e32
Author: jt <jt...@163.com>
AuthorDate: Fri Apr 12 22:34:32 2019 +0800

    fix an unproperly initialized var
---
 .../org/apache/iotdb/db/engine/memcontrol/RecordMemController.java | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/iotdb/src/main/java/org/apache/iotdb/db/engine/memcontrol/RecordMemController.java b/iotdb/src/main/java/org/apache/iotdb/db/engine/memcontrol/RecordMemController.java
index e96e280..80a8014 100644
--- a/iotdb/src/main/java/org/apache/iotdb/db/engine/memcontrol/RecordMemController.java
+++ b/iotdb/src/main/java/org/apache/iotdb/db/engine/memcontrol/RecordMemController.java
@@ -144,11 +144,12 @@ public class RecordMemController extends BasicMemController {
   @Override
   public void releaseUsage(Object user, long freeSize) {
     AtomicLong usage = memMap.get(user);
-    long usageLong = 0;
     if (usage == null) {
       LOGGER.error("Unregistered memory usage from {}", user);
-    } else if (freeSize > usageLong) {
-      usageLong = usage.get();
+      return;
+    }
+    long usageLong = usage.get();
+    if (freeSize > usageLong) {
       LOGGER
           .error("{} requests to free {} bytes while it only registered {} bytes", user,
               freeSize, usage);