public class OffHeapHelper
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
protected static org.apache.log4j.Logger |
logger |
| Constructor and Description |
|---|
OffHeapHelper() |
| Modifier and Type | Method and Description |
|---|---|
static void |
closeAllOffHeapRegions()
Closes all off-heap regions in the cache and waits for off-heap memory
to be empty (closing a region asynchronously releases the off-heap memor
y it held, so we want to wait for that to finish).
|
static void |
closeAllRegions()
Closes all offheap regions in the cache and waits for off-heap memory
to be empty (closing a region asynchronously releases the off-heap memory
it held, so we want to wait for that to finish).
|
static void |
dumpOffHeapOrphans()
use internal product calls to determine who the orphans are and log them
|
static java.util.Set<com.gemstone.gemfire.cache.Region<?,?>> |
getAllRegions()
Return a Set of all regions defined in this member.
|
static com.gemstone.gemfire.internal.offheap.OffHeapMemoryStats |
getOffHeapMemoryStats()
Return the off-heap memory stats object for this member
|
static boolean |
isOffHeapMemoryConfigured()
Determines if this member has off-heap memory currently allocated.
|
static void |
verifyOffHeapMemoryConsistency(boolean checkRefCounts)
Do consistency checks on off-heap memory.
|
static void |
verifyRegionsEnabledWithOffHeap(java.util.List<java.lang.String> regionNames)
Verify that the given list of full region path names have
off-heap memory enabled
|
static void |
waitForWanQueuesToDrain()
Wait for all async event queues (including wan queues) in this member
to drain.
|
public static void verifyOffHeapMemoryConsistency(boolean checkRefCounts)
This must be called when the system is quiet. * If there are persistent regions you cannot call this while asynchronous recovery of values is running. To make the test run with synchronous recovery of values, set the property gemfire.disk.recoverValuesSync=true. * Redundancy recovery for PartitionedRegions must not be running.
This method iterates all keys and values of all regions. If no regions are defined, this still provides consistency checks on off-heap memory as it verifies that there are no objects in off-heap as compared to off-heap stats; this check could indicate a leak if objects are found off-heap when no regions are defined.
Note that this validation trusts the enableOffHeapMemory region attribute in that it will verify that off-heap enabled regions have all entries off-heap and that region with off-heap disabled will have all entries in heap. To be completely thorough, the test can verify that each region's off-heap enabled attribute is correct before calling this method. See OffHeapHelper.verifyRegionsEnabledWithOffHeap(...) to verify this attribute on regions.
If no off-heap memory was configured for this member, then this method takes an early return.
checkRefCounts - If true, then check that all refCounts are exactly
1. If false skip the refCount check. During
validation, if any remote member is doing gets on
data that lives in this member, the refCounts
will be changing.public static void dumpOffHeapOrphans()
public static void closeAllRegions()
This is used to look for off-heap memory leaks. After all the regions are closed calling verifyOffHeapMemoryConsistency will detect any objects still in off-heap which indicates a leak.
public static void closeAllOffHeapRegions()
This is used to look for off-heap memory leaks. After all the regions are closed calling verifyOffHeapMemoryConsistency will detect any objects still in off-heap which indicates a leak.
public static java.util.Set<com.gemstone.gemfire.cache.Region<?,?>> getAllRegions()
public static void verifyRegionsEnabledWithOffHeap(java.util.List<java.lang.String> regionNames)
regionNames - A List of full region path names, or null of all
regions are expected to have off-heap enabled.public static boolean isOffHeapMemoryConfigured()
public static com.gemstone.gemfire.internal.offheap.OffHeapMemoryStats getOffHeapMemoryStats()
public static void waitForWanQueuesToDrain()