You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by ds...@apache.org on 2015/12/02 01:06:16 UTC
[07/13] incubator-geode git commit: improved close test
improved close test
Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/2b1d3902
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/2b1d3902
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/2b1d3902
Branch: refs/heads/feature/GEODE-607
Commit: 2b1d3902bb98c846d79fca3c9cd05bc953926181
Parents: ae138c1
Author: Darrel Schneider <ds...@pivotal.io>
Authored: Wed Nov 25 16:00:28 2015 -0800
Committer: Darrel Schneider <ds...@pivotal.io>
Committed: Wed Nov 25 16:00:28 2015 -0800
----------------------------------------------------------------------
.../offheap/SimpleMemoryAllocatorJUnitTest.java | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/2b1d3902/gemfire-core/src/test/java/com/gemstone/gemfire/internal/offheap/SimpleMemoryAllocatorJUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/offheap/SimpleMemoryAllocatorJUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/offheap/SimpleMemoryAllocatorJUnitTest.java
index f69c305..b1b77a9 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/offheap/SimpleMemoryAllocatorJUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/offheap/SimpleMemoryAllocatorJUnitTest.java
@@ -167,11 +167,24 @@ public class SimpleMemoryAllocatorJUnitTest {
@Test
public void testClose() {
UnsafeMemoryChunk slab = new UnsafeMemoryChunk(1024*1024);
+ boolean freeSlab = true;
try {
SimpleMemoryAllocatorImpl ma = SimpleMemoryAllocatorImpl.create(new NullOutOfOffHeapMemoryListener(), new NullOffHeapMemoryStats(), new UnsafeMemoryChunk[]{slab});
ma.close();
+ ma.close();
+ System.setProperty(SimpleMemoryAllocatorImpl.FREE_OFF_HEAP_MEMORY_PROPERTY, "true");
+ try {
+ ma = SimpleMemoryAllocatorImpl.create(new NullOutOfOffHeapMemoryListener(), new NullOffHeapMemoryStats(), new UnsafeMemoryChunk[]{slab});
+ ma.close();
+ freeSlab = false;
+ ma.close();
+ } finally {
+ System.clearProperty(SimpleMemoryAllocatorImpl.FREE_OFF_HEAP_MEMORY_PROPERTY);
+ }
} finally {
- SimpleMemoryAllocatorImpl.freeOffHeapMemory();
+ if (freeSlab) {
+ SimpleMemoryAllocatorImpl.freeOffHeapMemory();
+ }
}
}