You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by cl...@apache.org on 2018/03/06 15:20:40 UTC
[2/2] activemq-artemis git commit: ARTEMIS-1728 Reclaim memory when
page cursor complete
ARTEMIS-1728 Reclaim memory when page cursor complete
Free hash set used to hold page position for acks and removed refs.
The two set is cleared, but they still hold a big array.
It is safe to replace the old one with empty set.
Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/7f606a46
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/7f606a46
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/7f606a46
Branch: refs/heads/master
Commit: 7f606a469023b8422ec4f3da4a55a7ddf7363d1f
Parents: 79ad9cb
Author: huaishk <sh...@gmail.com>
Authored: Mon Mar 5 17:32:29 2018 +0800
Committer: Clebert Suconic <cl...@apache.org>
Committed: Tue Mar 6 10:20:32 2018 -0500
----------------------------------------------------------------------
.../artemis/core/paging/cursor/impl/PageSubscriptionImpl.java | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/7f606a46/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/impl/PageSubscriptionImpl.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/impl/PageSubscriptionImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/impl/PageSubscriptionImpl.java
index d970f8a..a767c09 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/impl/PageSubscriptionImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/impl/PageSubscriptionImpl.java
@@ -334,7 +334,9 @@ final class PageSubscriptionImpl implements PageSubscription {
}
infoPG.acks.clear();
+ infoPG.acks = Collections.synchronizedSet(new LinkedHashSet<PagePosition>());
infoPG.removedReferences.clear();
+ infoPG.removedReferences = new ConcurrentHashSet<>();
}
tx.addOperation(new TransactionOperationAbstract() {
@@ -901,11 +903,11 @@ final class PageSubscriptionImpl implements PageSubscription {
private final long pageId;
// Confirmed ACKs on this page
- private final Set<PagePosition> acks = Collections.synchronizedSet(new LinkedHashSet<PagePosition>());
+ private Set<PagePosition> acks = Collections.synchronizedSet(new LinkedHashSet<PagePosition>());
private WeakReference<PageCache> cache;
- private final Set<PagePosition> removedReferences = new ConcurrentHashSet<>();
+ private Set<PagePosition> removedReferences = new ConcurrentHashSet<>();
// The page was live at the time of the creation
private final boolean wasLive;