ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [26/43] ignite git commit: IGNITE-4712 Memory leaks in PageMemory
Date Fri, 10 Mar 2017 07:23:47 GMT
IGNITE-4712 Memory leaks in PageMemory


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/6e56fa2a
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/6e56fa2a
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/6e56fa2a

Branch: refs/heads/ignite-4712
Commit: 6e56fa2a8eeb019f063da51df73e8922a114ba3d
Parents: b3d78b5
Author: Igor Seliverstov <gvvinblade@gmail.com>
Authored: Mon Feb 20 16:40:25 2017 +0300
Committer: Igor Seliverstov <gvvinblade@gmail.com>
Committed: Wed Mar 1 10:44:54 2017 +0300

----------------------------------------------------------------------
 .../cache/database/freelist/PagesList.java      | 30 ++++++++++++++++++--
 1 file changed, 28 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/6e56fa2a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/freelist/PagesList.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/freelist/PagesList.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/freelist/PagesList.java
index 1f537b6..5ae3549 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/freelist/PagesList.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/freelist/PagesList.java
@@ -189,6 +189,7 @@ public abstract class PagesList extends DataStructure {
 
                 for (Map.Entry<Integer, GridLongList> e : bucketsData.entrySet()) {
                     int bucket = e.getKey();
+                    long bucketSize = 0;
 
                     Stripe[] old = getBucket(bucket);
                     assert old == null;
@@ -197,11 +198,36 @@ public abstract class PagesList extends DataStructure {
 
                     Stripe[] tails = new Stripe[upd.length];
 
-                    for (int i = 0; i < upd.length; i++)
-                        tails[i] = new Stripe(upd[i]);
+                    for (int i = 0; i < upd.length; i++) {
+                        long tailId = upd[i];
+
+                        try(Page tail = page(tailId)) {
+                            long tailAddr = readLock(tail);
+
+                            assert tailAddr != 0L;
+
+                            try {
+                                PagesListNodeIO io = PagesListNodeIO.VERSIONS.forPage(tailAddr);
+
+                                int count = io.getCount(tailAddr);
+
+                                Stripe stripe = new Stripe(tailId);
+                                stripe.empty = count == 0;
+
+                                tails[i] = stripe;
+
+                                bucketSize += count;
+                            }
+                            finally {
+                                readUnlock(tail, tailAddr);
+                            }
+                        }
+                    }
 
                     boolean ok = casBucket(bucket, null, tails);
                     assert ok;
+
+                    bucketsSize[bucket].set(bucketSize);
                 }
             }
         }


Mime
View raw message