You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by jb...@apache.org on 2011/09/08 21:50:06 UTC
svn commit: r1166876 -
/cassandra/trunk/src/java/org/apache/cassandra/utils/SlabAllocator.java
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()