Skip to content

Commit

Permalink
Force all native allocations and deallocation to track
Browse files Browse the repository at this point in the history
amount of requested and freed bytes
  • Loading branch information
MishaDemianenko committed Feb 1, 2018
1 parent 35938da commit c1049c8
Show file tree
Hide file tree
Showing 23 changed files with 192 additions and 119 deletions.
34 changes: 23 additions & 11 deletions community/io/src/main/java/org/neo4j/io/mem/GrabAllocator.java
Expand Up @@ -19,6 +19,7 @@
*/ */
package org.neo4j.io.mem; package org.neo4j.io.mem;


import org.neo4j.memory.MemoryAllocationTracker;
import org.neo4j.unsafe.impl.internal.dragons.UnsafeUtil; import org.neo4j.unsafe.impl.internal.dragons.UnsafeUtil;


import static org.neo4j.io.ByteUnit.kibiBytes; import static org.neo4j.io.ByteUnit.kibiBytes;
Expand All @@ -39,6 +40,7 @@ public final class GrabAllocator implements MemoryAllocator
* The amount of memory that this memory manager can still allocate. * The amount of memory that this memory manager can still allocate.
*/ */
private long memoryReserve; private long memoryReserve;
private final MemoryAllocationTracker memoryTracker;


private Grab grabs; private Grab grabs;


Expand All @@ -47,10 +49,12 @@ public final class GrabAllocator implements MemoryAllocator
* given alignment size. * given alignment size.
* @param expectedMaxMemory The maximum amount of memory that this memory manager is expected to allocate. The * @param expectedMaxMemory The maximum amount of memory that this memory manager is expected to allocate. The
* actual amount of memory used can end up greater than this value, if some of it gets wasted on alignment padding. * actual amount of memory used can end up greater than this value, if some of it gets wasted on alignment padding.
* @param memoryTracker memory usage tracker
*/ */
GrabAllocator( long expectedMaxMemory ) GrabAllocator( long expectedMaxMemory, MemoryAllocationTracker memoryTracker )
{ {
this.memoryReserve = expectedMaxMemory; this.memoryReserve = expectedMaxMemory;
this.memoryTracker = memoryTracker;
} }


@Override @Override
Expand Down Expand Up @@ -93,12 +97,12 @@ public synchronized long allocateAligned( long bytes, long alignment )
// This is a huge allocation. Put it in its own grab and keep any existing grab at the head. // This is a huge allocation. Put it in its own grab and keep any existing grab at the head.
grabSize = bytes; grabSize = bytes;
Grab nextGrab = grabs == null ? null : grabs.next; Grab nextGrab = grabs == null ? null : grabs.next;
Grab allocationGrab = new Grab( nextGrab, grabSize ); Grab allocationGrab = new Grab( nextGrab, grabSize, memoryTracker );
if ( !allocationGrab.canAllocate( bytes ) ) if ( !allocationGrab.canAllocate( bytes ) )
{ {
allocationGrab.free(); allocationGrab.free();
grabSize = bytes + alignment; grabSize = bytes + alignment;
allocationGrab = new Grab( nextGrab, grabSize ); allocationGrab = new Grab( nextGrab, grabSize, memoryTracker );
} }
long allocation = allocationGrab.allocate( bytes, alignment ); long allocation = allocationGrab.allocate( bytes, alignment );
grabs = grabs == null ? allocationGrab : grabs.setNext( allocationGrab ); grabs = grabs == null ? allocationGrab : grabs.setNext( allocationGrab );
Expand All @@ -111,7 +115,7 @@ public synchronized long allocateAligned( long bytes, long alignment )
if ( grabSize < bytes ) if ( grabSize < bytes )
{ {
grabSize = bytes; grabSize = bytes;
Grab grab = new Grab( grabs, grabSize ); Grab grab = new Grab( grabs, grabSize, memoryTracker );
if ( grab.canAllocate( bytes ) ) if ( grab.canAllocate( bytes ) )
{ {
memoryReserve -= grabSize; memoryReserve -= grabSize;
Expand All @@ -121,7 +125,7 @@ public synchronized long allocateAligned( long bytes, long alignment )
grab.free(); grab.free();
grabSize = bytes + alignment; grabSize = bytes + alignment;
} }
grabs = new Grab( grabs, grabSize ); grabs = new Grab( grabs, grabSize, memoryTracker );
memoryReserve -= grabSize; memoryReserve -= grabSize;
} }
return grabs.allocate( bytes, alignment ); return grabs.allocate( bytes, alignment );
Expand Down Expand Up @@ -162,8 +166,13 @@ private void initCause( NativeMemoryAllocationRefusedError error, OutOfMemoryErr
protected synchronized void finalize() throws Throwable protected synchronized void finalize() throws Throwable
{ {
super.finalize(); super.finalize();
Grab current = grabs; close();
}


@Override
public void close()
{
Grab current = grabs;
while ( current != null ) while ( current != null )
{ {
current.free(); current.free();
Expand All @@ -176,22 +185,25 @@ private static class Grab
public final Grab next; public final Grab next;
private final long address; private final long address;
private final long limit; private final long limit;
private final MemoryAllocationTracker memoryTracker;
private long nextPointer; private long nextPointer;


Grab( Grab next, long size ) Grab( Grab next, long size, MemoryAllocationTracker memoryTracker )
{ {
this.next = next; this.next = next;
this.address = UnsafeUtil.allocateMemory( size ); this.address = UnsafeUtil.allocateMemory( size, memoryTracker );
this.limit = address + size; this.limit = address + size;
this.memoryTracker = memoryTracker;
nextPointer = address; nextPointer = address;
} }


Grab( Grab next, long address, long limit, long nextPointer ) Grab( Grab next, long address, long limit, long nextPointer, MemoryAllocationTracker memoryTracker )
{ {
this.next = next; this.next = next;
this.address = address; this.address = address;
this.limit = limit; this.limit = limit;
this.nextPointer = nextPointer; this.nextPointer = nextPointer;
this.memoryTracker = memoryTracker;
} }


private long nextAligned( long pointer, long alignment ) private long nextAligned( long pointer, long alignment )
Expand All @@ -213,7 +225,7 @@ long allocate( long bytes, long alignment )


void free() void free()
{ {
UnsafeUtil.free( address ); UnsafeUtil.free( address, limit - address, memoryTracker );
} }


boolean canAllocate( long bytes ) boolean canAllocate( long bytes )
Expand All @@ -223,7 +235,7 @@ boolean canAllocate( long bytes )


Grab setNext( Grab grab ) Grab setNext( Grab grab )
{ {
return new Grab( grab, address, limit, nextPointer ); return new Grab( grab, address, limit, nextPointer, memoryTracker );
} }


@Override @Override
Expand Down
10 changes: 8 additions & 2 deletions community/io/src/main/java/org/neo4j/io/mem/MemoryAllocator.java
Expand Up @@ -20,15 +20,16 @@
package org.neo4j.io.mem; package org.neo4j.io.mem;


import org.neo4j.io.ByteUnit; import org.neo4j.io.ByteUnit;
import org.neo4j.memory.MemoryAllocationTracker;


/** /**
* A MemoryAllocator is simple: it only allocates memory, until it itself is finalizable and frees it all in one go. * A MemoryAllocator is simple: it only allocates memory, until it itself is finalizable and frees it all in one go.
*/ */
public interface MemoryAllocator public interface MemoryAllocator
{ {
static MemoryAllocator createAllocator( String expectedMemory ) static MemoryAllocator createAllocator( String expectedMemory, MemoryAllocationTracker memoryTracker )
{ {
return new GrabAllocator( ByteUnit.parse( expectedMemory ) ); return new GrabAllocator( ByteUnit.parse( expectedMemory ), memoryTracker );
} }


/** /**
Expand All @@ -49,4 +50,9 @@ static MemoryAllocator createAllocator( String expectedMemory )
* @throws OutOfMemoryError if the requested memory could not be allocated. * @throws OutOfMemoryError if the requested memory could not be allocated.
*/ */
long allocateAligned( long bytes, long alignment ); long allocateAligned( long bytes, long alignment );

/**
* Close allocator and release all allocated resources
*/
void close();
} }
Expand Up @@ -47,6 +47,8 @@
import org.neo4j.io.pagecache.tracing.PageCacheTracer; import org.neo4j.io.pagecache.tracing.PageCacheTracer;
import org.neo4j.io.pagecache.tracing.PageFaultEvent; import org.neo4j.io.pagecache.tracing.PageFaultEvent;
import org.neo4j.io.pagecache.tracing.cursor.PageCursorTracerSupplier; import org.neo4j.io.pagecache.tracing.cursor.PageCursorTracerSupplier;
import org.neo4j.memory.GlobalMemoryTracker;
import org.neo4j.memory.MemoryAllocationTracker;
import org.neo4j.unsafe.impl.internal.dragons.UnsafeUtil; import org.neo4j.unsafe.impl.internal.dragons.UnsafeUtil;


import static org.neo4j.util.FeatureToggles.flag; import static org.neo4j.util.FeatureToggles.flag;
Expand Down Expand Up @@ -219,7 +221,7 @@ public MuninnPageCache(
{ {
this( swapperFactory, this( swapperFactory,
// Cast to long prevents overflow: // Cast to long prevents overflow:
MemoryAllocator.createAllocator( "" + memoryRequiredForPages( maxPages ) ), MemoryAllocator.createAllocator( "" + memoryRequiredForPages( maxPages ), GlobalMemoryTracker.INSTANCE ),
PAGE_SIZE, PAGE_SIZE,
pageCacheTracer, pageCacheTracer,
pageCursorTracerSupplier ); pageCursorTracerSupplier );
Expand Down Expand Up @@ -261,6 +263,7 @@ public MuninnPageCache(


// Expose the total number of pages // Expose the total number of pages
pageCacheTracer.maxPages( maxPages ); pageCacheTracer.maxPages( maxPages );
MemoryAllocationTracker memoryTracker = GlobalMemoryTracker.INSTANCE;


this.pageCacheId = pageCacheIdCounter.incrementAndGet(); this.pageCacheId = pageCacheIdCounter.incrementAndGet();
this.swapperFactory = swapperFactory; this.swapperFactory = swapperFactory;
Expand All @@ -270,7 +273,7 @@ public MuninnPageCache(
this.pageCursorTracerSupplier = pageCursorTracerSupplier; this.pageCursorTracerSupplier = pageCursorTracerSupplier;
this.printExceptionsOnClose = true; this.printExceptionsOnClose = true;
long alignment = swapperFactory.getRequiredBufferAlignment(); long alignment = swapperFactory.getRequiredBufferAlignment();
this.victimPage = VictimPageReference.getVictimPage( cachePageSize ); this.victimPage = VictimPageReference.getVictimPage( cachePageSize, memoryTracker );
this.pages = new PageList( maxPages, cachePageSize, memoryAllocator, new SwapperSet(), victimPage, alignment ); this.pages = new PageList( maxPages, cachePageSize, memoryAllocator, new SwapperSet(), victimPage, alignment );


setFreelistHead( new AtomicInteger() ); setFreelistHead( new AtomicInteger() );
Expand Down
Expand Up @@ -26,6 +26,7 @@
import org.neo4j.io.pagecache.impl.SingleFilePageSwapperFactory; import org.neo4j.io.pagecache.impl.SingleFilePageSwapperFactory;
import org.neo4j.io.pagecache.tracing.PageCacheTracer; import org.neo4j.io.pagecache.tracing.PageCacheTracer;
import org.neo4j.io.pagecache.tracing.cursor.DefaultPageCursorTracerSupplier; import org.neo4j.io.pagecache.tracing.cursor.DefaultPageCursorTracerSupplier;
import org.neo4j.memory.GlobalMemoryTracker;


/* /*
* This class is an helper to allow to construct properly a page cache in the few places we need it without all * This class is an helper to allow to construct properly a page cache in the few places we need it without all
Expand All @@ -47,7 +48,7 @@ public static PageCache createPageCache( FileSystemAbstraction fileSystem )


PageCacheTracer cacheTracer = PageCacheTracer.NULL; PageCacheTracer cacheTracer = PageCacheTracer.NULL;
DefaultPageCursorTracerSupplier cursorTracerSupplier = DefaultPageCursorTracerSupplier.INSTANCE; DefaultPageCursorTracerSupplier cursorTracerSupplier = DefaultPageCursorTracerSupplier.INSTANCE;
MemoryAllocator memoryAllocator = MemoryAllocator.createAllocator( "8 MiB" ); MemoryAllocator memoryAllocator = MemoryAllocator.createAllocator( "8 MiB", GlobalMemoryTracker.INSTANCE );
return new MuninnPageCache( factory, memoryAllocator, cacheTracer, cursorTracerSupplier ); return new MuninnPageCache( factory, memoryAllocator, cacheTracer, cursorTracerSupplier );
} }
} }
Expand Up @@ -19,6 +19,7 @@
*/ */
package org.neo4j.io.pagecache.impl.muninn; package org.neo4j.io.pagecache.impl.muninn;


import org.neo4j.memory.MemoryAllocationTracker;
import org.neo4j.unsafe.impl.internal.dragons.UnsafeUtil; import org.neo4j.unsafe.impl.internal.dragons.UnsafeUtil;


class VictimPageReference class VictimPageReference
Expand All @@ -31,14 +32,14 @@ private VictimPageReference()
// All state is static // All state is static
} }


static synchronized long getVictimPage( int pageSize ) static synchronized long getVictimPage( int pageSize, MemoryAllocationTracker allocationTracker )
{ {
if ( victimPageSize < pageSize ) if ( victimPageSize < pageSize )
{ {
// Note that we NEVER free any old victim pages. This is important because we cannot tell // Note that we NEVER free any old victim pages. This is important because we cannot tell
// when we are done using them. Therefor, victim pages are allocated and stay allocated // when we are done using them. Therefor, victim pages are allocated and stay allocated
// until our process terminates. // until our process terminates.
victimPagePointer = UnsafeUtil.allocateMemory( pageSize ); victimPagePointer = UnsafeUtil.allocateMemory( pageSize, allocationTracker );
victimPageSize = pageSize; victimPageSize = pageSize;
} }
return victimPagePointer; return victimPagePointer;
Expand Down
Expand Up @@ -21,13 +21,16 @@


import org.junit.Test; import org.junit.Test;


import org.neo4j.io.ByteUnit;
import org.neo4j.io.pagecache.PageCache; import org.neo4j.io.pagecache.PageCache;
import org.neo4j.memory.LocalMemoryTracker;
import org.neo4j.unsafe.impl.internal.dragons.UnsafeUtil; import org.neo4j.unsafe.impl.internal.dragons.UnsafeUtil;


import static org.hamcrest.Matchers.greaterThanOrEqualTo; import static org.hamcrest.Matchers.greaterThanOrEqualTo;
import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.lessThanOrEqualTo; import static org.hamcrest.Matchers.lessThanOrEqualTo;
import static org.hamcrest.Matchers.not; import static org.hamcrest.Matchers.not;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat; import static org.junit.Assert.assertThat;


public class MemoryAllocatorTest public class MemoryAllocatorTest
Expand All @@ -37,7 +40,7 @@ public class MemoryAllocatorTest


protected MemoryAllocator createAllocator( String expectedMaxMemory ) protected MemoryAllocator createAllocator( String expectedMaxMemory )
{ {
return MemoryAllocator.createAllocator( expectedMaxMemory ); return MemoryAllocator.createAllocator( expectedMaxMemory, new LocalMemoryTracker() );
} }


@Test @Test
Expand Down Expand Up @@ -114,4 +117,20 @@ public void allocatingMustIncreaseMemoryUsedAndDecreaseAvailableMemory() throws
assertThat( mman.usedMemory(), is( greaterThanOrEqualTo( 97L ) ) ); assertThat( mman.usedMemory(), is( greaterThanOrEqualTo( 97L ) ) );
assertThat( mman.availableMemory(), is( lessThanOrEqualTo( PageCache.PAGE_SIZE - 97L ) ) ); assertThat( mman.availableMemory(), is( lessThanOrEqualTo( PageCache.PAGE_SIZE - 97L ) ) );
} }

@Test
public void trackMemoryAllocations()
{
LocalMemoryTracker memoryTracker = new LocalMemoryTracker();
MemoryAllocator allocator = MemoryAllocator.createAllocator( "2m", memoryTracker );

assertEquals( 0, memoryTracker.usedDirectMemory() );

long pointer = allocator.allocateAligned( ByteUnit.mebiBytes( 1 ), 1 );

assertEquals( ByteUnit.mebiBytes( 1 ), memoryTracker.usedDirectMemory() );

allocator.close();
assertEquals( 0, memoryTracker.usedDirectMemory() );
}
} }
Expand Up @@ -43,6 +43,7 @@
import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.atomic.AtomicLong;


import org.neo4j.io.mem.MemoryAllocator; import org.neo4j.io.mem.MemoryAllocator;
import org.neo4j.memory.LocalMemoryTracker;
import org.neo4j.test.rule.TestDirectory; import org.neo4j.test.rule.TestDirectory;
import org.neo4j.unsafe.impl.internal.dragons.UnsafeUtil; import org.neo4j.unsafe.impl.internal.dragons.UnsafeUtil;


Expand Down Expand Up @@ -70,7 +71,7 @@ public abstract class PageSwapperTest


private final ConcurrentLinkedQueue<PageSwapperFactory> openedFactories = new ConcurrentLinkedQueue<>(); private final ConcurrentLinkedQueue<PageSwapperFactory> openedFactories = new ConcurrentLinkedQueue<>();
private final ConcurrentLinkedQueue<PageSwapper> openedSwappers = new ConcurrentLinkedQueue<>(); private final ConcurrentLinkedQueue<PageSwapper> openedSwappers = new ConcurrentLinkedQueue<>();
private final MemoryAllocator mman = MemoryAllocator.createAllocator( "32 KiB" ); private final MemoryAllocator mman = MemoryAllocator.createAllocator( "32 KiB", new LocalMemoryTracker() );


protected abstract PageSwapperFactory swapperFactory() throws Exception; protected abstract PageSwapperFactory swapperFactory() throws Exception;


Expand Down
Expand Up @@ -25,6 +25,8 @@


import org.neo4j.io.ByteUnit; import org.neo4j.io.ByteUnit;
import org.neo4j.io.mem.MemoryAllocator; import org.neo4j.io.mem.MemoryAllocator;
import org.neo4j.memory.GlobalMemoryTracker;
import org.neo4j.memory.LocalMemoryTracker;


import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
Expand All @@ -43,9 +45,9 @@ public void veryLargePageListsMustBeFullyAccessible() throws Exception
long pageCacheSize = ByteUnit.gibiBytes( 513 ) + pageSize; long pageCacheSize = ByteUnit.gibiBytes( 513 ) + pageSize;
int pages = Math.toIntExact( pageCacheSize / pageSize ); int pages = Math.toIntExact( pageCacheSize / pageSize );


MemoryAllocator mman = MemoryAllocator.createAllocator( "2 GiB" ); MemoryAllocator mman = MemoryAllocator.createAllocator( "2 GiB", new LocalMemoryTracker() );
SwapperSet swappers = new SwapperSet(); SwapperSet swappers = new SwapperSet();
long victimPage = VictimPageReference.getVictimPage( pageSize ); long victimPage = VictimPageReference.getVictimPage( pageSize, GlobalMemoryTracker.INSTANCE );


PageList pageList = new PageList( pages, pageSize, mman, swappers, victimPage, Long.BYTES ); PageList pageList = new PageList( pages, pageSize, mman, swappers, victimPage, Long.BYTES );


Expand Down
Expand Up @@ -27,6 +27,7 @@
import org.neo4j.io.pagecache.PageSwapperFactory; import org.neo4j.io.pagecache.PageSwapperFactory;
import org.neo4j.io.pagecache.tracing.PageCacheTracer; import org.neo4j.io.pagecache.tracing.PageCacheTracer;
import org.neo4j.io.pagecache.tracing.cursor.PageCursorTracerSupplier; import org.neo4j.io.pagecache.tracing.cursor.PageCursorTracerSupplier;
import org.neo4j.memory.LocalMemoryTracker;


public class MuninnPageCacheFixture extends PageCacheTestSupport.Fixture<MuninnPageCache> public class MuninnPageCacheFixture extends PageCacheTestSupport.Fixture<MuninnPageCache>
{ {
Expand All @@ -37,7 +38,8 @@ public MuninnPageCache createPageCache( PageSwapperFactory swapperFactory, int m
PageCacheTracer tracer, PageCursorTracerSupplier cursorTracerSupplier ) PageCacheTracer tracer, PageCursorTracerSupplier cursorTracerSupplier )
{ {
long memory = MuninnPageCache.memoryRequiredForPages( maxPages ); long memory = MuninnPageCache.memoryRequiredForPages( maxPages );
MemoryAllocator allocator = MemoryAllocator.createAllocator( String.valueOf( memory ) ); MemoryAllocator allocator = MemoryAllocator.createAllocator( String.valueOf( memory ),
new LocalMemoryTracker() );
return new MuninnPageCache( swapperFactory, allocator, tracer, cursorTracerSupplier ); return new MuninnPageCache( swapperFactory, allocator, tracer, cursorTracerSupplier );
} }


Expand Down
Expand Up @@ -50,6 +50,8 @@
import org.neo4j.io.pagecache.tracing.FlushEvent; import org.neo4j.io.pagecache.tracing.FlushEvent;
import org.neo4j.io.pagecache.tracing.FlushEventOpportunity; import org.neo4j.io.pagecache.tracing.FlushEventOpportunity;
import org.neo4j.io.pagecache.tracing.PageFaultEvent; import org.neo4j.io.pagecache.tracing.PageFaultEvent;
import org.neo4j.memory.GlobalMemoryTracker;
import org.neo4j.memory.LocalMemoryTracker;
import org.neo4j.unsafe.impl.internal.dragons.UnsafeUtil; import org.neo4j.unsafe.impl.internal.dragons.UnsafeUtil;


import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.equalTo;
Expand Down Expand Up @@ -87,7 +89,7 @@ public static Iterable<Object[]> parameters()
public static void setUpStatics() public static void setUpStatics()
{ {
executor = Executors.newCachedThreadPool( new DaemonThreadFactory() ); executor = Executors.newCachedThreadPool( new DaemonThreadFactory() );
mman = MemoryAllocator.createAllocator( "1 MiB" ); mman = MemoryAllocator.createAllocator( "1 MiB", new LocalMemoryTracker() );
} }


@AfterClass @AfterClass
Expand Down Expand Up @@ -123,7 +125,7 @@ public PageListTest( int pageId )
public void setUp() public void setUp()
{ {
swappers = new SwapperSet(); swappers = new SwapperSet();
long victimPage = VictimPageReference.getVictimPage( pageSize ); long victimPage = VictimPageReference.getVictimPage( pageSize, GlobalMemoryTracker.INSTANCE );
pageList = new PageList( pageIds.length, pageSize, mman, swappers, victimPage, ALIGNMENT ); pageList = new PageList( pageIds.length, pageSize, mman, swappers, victimPage, ALIGNMENT );
pageRef = pageList.deref( pageId ); pageRef = pageList.deref( pageId );
prevPageRef = pageList.deref( prevPageId ); prevPageRef = pageList.deref( prevPageId );
Expand All @@ -134,7 +136,7 @@ public void setUp()
public void mustExposePageCount() throws Exception public void mustExposePageCount() throws Exception
{ {
int pageCount; int pageCount;
long victimPage = VictimPageReference.getVictimPage( pageSize ); long victimPage = VictimPageReference.getVictimPage( pageSize, GlobalMemoryTracker.INSTANCE );


pageCount = 3; pageCount = 3;
assertThat( new PageList( pageCount, pageSize, mman, swappers, victimPage, ALIGNMENT ).getPageCount(), assertThat( new PageList( pageCount, pageSize, mman, swappers, victimPage, ALIGNMENT ).getPageCount(),
Expand Down Expand Up @@ -1195,7 +1197,8 @@ public void unlockWriteAndTryTakeFlushLockMustInvalidateReadersOverlappingWithWr
@Test @Test
public void mustExposeCachePageSize() throws Exception public void mustExposeCachePageSize() throws Exception
{ {
PageList list = new PageList( 0, 42, mman, swappers, VictimPageReference.getVictimPage( 42 ), ALIGNMENT ); PageList list = new PageList( 0, 42, mman, swappers,
VictimPageReference.getVictimPage( 42, GlobalMemoryTracker.INSTANCE ), ALIGNMENT );
assertThat( list.getCachePageSize(), is( 42 ) ); assertThat( list.getCachePageSize(), is( 42 ) );
} }


Expand Down
Expand Up @@ -35,6 +35,7 @@
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;


import org.neo4j.memory.GlobalMemoryTracker;
import org.neo4j.test.rule.RepeatRule; import org.neo4j.test.rule.RepeatRule;
import org.neo4j.unsafe.impl.internal.dragons.UnsafeUtil; import org.neo4j.unsafe.impl.internal.dragons.UnsafeUtil;


Expand All @@ -56,7 +57,7 @@ public static void shutDownExecutor()
@Before @Before
public void allocateLock() public void allocateLock()
{ {
lockAddr = UnsafeUtil.allocateMemory( Long.BYTES ); lockAddr = UnsafeUtil.allocateMemory( Long.BYTES, GlobalMemoryTracker.INSTANCE );
UnsafeUtil.putLong( lockAddr, 0 ); UnsafeUtil.putLong( lockAddr, 0 );
} }


Expand Down

0 comments on commit c1049c8

Please sign in to comment.