ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [39/43] ignite git commit: IGNITE-4712 Memory leaks in PageMemory
Date Fri, 10 Mar 2017 07:24:00 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/4e7912ab
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/4e7912ab
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/4e7912ab

Branch: refs/heads/ignite-4712
Commit: 4e7912ab62c3e0a69b505a3216987692b3cd8c01
Parents: 7d6bf32
Author: Igor Seliverstov <gvvinblade@gmail.com>
Authored: Wed Feb 22 11:28:14 2017 +0300
Committer: Igor Seliverstov <gvvinblade@gmail.com>
Committed: Wed Mar 1 10:44:55 2017 +0300

----------------------------------------------------------------------
 .../cache/database/freelist/PagesList.java      | 38 ++++++++------------
 1 file changed, 14 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/4e7912ab/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 5fdd191..b2c6e9c 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
@@ -200,23 +200,17 @@ public abstract class PagesList extends DataStructure {
                     for (int i = 0; i < upd.length; i++) {
                         long tailId = upd[i];
 
-                        // TODO: just relase readlock.
-                        List<Page> locked = new ArrayList<>(2);
-                        List<Long> lockedAddrs = new ArrayList<>(2);
+                        long pageId = tailId;
+                        int count = 0;
 
-                        try {
-                            long pageId = tailId;
-                            int count = 0;
-
-                            while (pageId != 0L) {
-                                try (Page page = page(pageId)) {
-                                    long pageAddr = readLock(page);
+                        while (pageId != 0L) {
 
-                                    assert pageAddr != 0L;
+                            try (Page page = page(pageId)) {
+                                long pageAddr = readLock(page);
 
-                                    locked.add(page);
-                                    lockedAddrs.add(pageAddr);
+                                assert pageAddr != 0L;
 
+                                try {
                                     PagesListNodeIO io = PagesListNodeIO.VERSIONS.forPage(pageAddr);
 
                                     count += io.getCount(pageAddr);
@@ -226,19 +220,15 @@ public abstract class PagesList extends DataStructure {
                                     if (isReuseBucket(bucket) && pageId != 0L)
                                         count++;
                                 }
-                            }
-
-                            Stripe stripe = new Stripe(tailId, count == 0);
-
-                            tails[i] = stripe;
-
-                            bucketSize += count;
-                        }
-                        finally {
-                            for (int j = 0; j < locked.size(); j++) {
-                                readUnlock(locked.get(j), lockedAddrs.get(j));
+                                finally {
+                                    readUnlock(page, pageAddr);
+                                }
                             }
                         }
+
+                        Stripe stripe = new Stripe(tailId, count == 0);
+                        tails[i] = stripe;
+                        bucketSize += count;
                     }
 
                     boolean ok = casBucket(bucket, null, tails);


Mime
View raw message