diff --git a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/locking/EntityInfoManager.java b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/locking/EntityInfoManager.java
index d9df1d7..5d81e8a 100644
--- a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/locking/EntityInfoManager.java
+++ b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/locking/EntityInfoManager.java
@@ -231,57 +231,33 @@
      */
     private void shrink() {
         int i;
-        boolean bContiguous = true;
-        int decreaseCount = 0;
+        int removeCount = 0;
         int size = pArray.size();
         int maxDecreaseCount = size / 2;
         ChildEntityInfoArrayManager child;
 
-        for (i = 0; i < size; i++) {
-            if (pArray.get(i).isDeinitialized()) {
-                decreaseCount++;
+        //The first buffer never be deinitialized.
+        for (i = 1; i < size; i++) {
+            if (pArray.get(i).isEmpty()) {
+                pArray.get(i).deinitialize();
             }
         }
 
-        if (decreaseCount < maxDecreaseCount) {
-
-            for (i = size - 1; i >= 0; i--) {
-                child = pArray.get(i);
-                if (child.isEmpty() || child.isDeinitialized()) {
-                    if (bContiguous) {
-                        pArray.remove(i);
-                        if (child.isEmpty()) {
-                            if (++decreaseCount == maxDecreaseCount) {
-                                break;
-                            }
-                        }
-                    } else {
-                        bContiguous = false;
-                        if (child.isEmpty()) {
-                            child.deinitialize();
-                            if (++decreaseCount == maxDecreaseCount) {
-                                break;
-                            }
-                        }
-                    }
-                } else {
-                    bContiguous = false;
+        //remove the empty buffers from the end
+        for (i = size - 1; i >= 1; i--) {
+            child = pArray.get(i);
+            if (child.isDeinitialized()) {
+                pArray.remove(i);
+                if (++removeCount == maxDecreaseCount) {
+                    break;
                 }
-            }
-
-            //reset allocChild when the child is removed or deinitialized.
-            size = pArray.size();
-            if (allocChild >= size || pArray.get(allocChild).isDeinitialized()) {
-                //set allocChild to any initialized one.
-                //It is guaranteed that there is at least one initialized child.
-                for (i = 0; i < size; i++) {
-                    if (!pArray.get(i).isDeinitialized()) {
-                        allocChild = i;
-                        break;
-                    }
-                }
+            } else {
+                break;
             }
         }
+        
+        //reset allocChild to the first buffer
+        allocChild = 0;
 
         isShrinkTimerOn = false;
     }
