cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r1166876 - /cassandra/trunk/src/java/org/apache/cassandra/utils/SlabAllocator.java
Date Thu, 08 Sep 2011 19:50:06 GMT
Author: jbellis
Date: Thu Sep  8 19:50:06 2011
New Revision: 1166876

URL: http://svn.apache.org/viewvc?rev=1166876&view=rev
Log:
use weak references to track slab regions
patch by jbellis; reviewed by stuhood for CASSANDRA-3162

Modified:
    cassandra/trunk/src/java/org/apache/cassandra/utils/SlabAllocator.java

Modified: cassandra/trunk/src/java/org/apache/cassandra/utils/SlabAllocator.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/utils/SlabAllocator.java?rev=1166876&r1=1166875&r2=1166876&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/utils/SlabAllocator.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/utils/SlabAllocator.java Thu Sep  8 19:50:06
2011
@@ -28,6 +28,7 @@ import java.util.concurrent.atomic.Atomi
 
 import com.google.common.base.Preconditions;
 import com.google.common.collect.Iterables;
+import com.google.common.collect.MapMaker;
 
 /**
  * The SlabAllocator is a bump-the-pointer allocator that allocates
@@ -45,11 +46,11 @@ import com.google.common.collect.Iterabl
  */
 public class SlabAllocator extends Allocator
 {
-    private final static int REGION_SIZE = 2 * 1024 * 1024;
-    private final static int MAX_CLONED_SIZE = 256 * 1024; // bigger than this don't go in
the region
+    private final static int REGION_SIZE = 1024 * 1024;
+    private final static int MAX_CLONED_SIZE = 128 * 1024; // bigger than this don't go in
the region
 
     private final AtomicReference<Region> currentRegion = new AtomicReference<Region>();
-    private final Collection<Region> filledRegions = new LinkedBlockingQueue<Region>();
+    private final Collection<Region> filledRegions = Collections.newSetFromMap(new
MapMaker().weakKeys().<Region, Boolean>makeMap());
 
     /** @return Total number of bytes allocated by this allocator. */
     public long size()



Mime
View raw message