Search in sources :

Example 16 with LocalMemoryTracker

use of org.neo4j.memory.LocalMemoryTracker in project neo4j by neo4j.

the class ForsetiMemoryTrackingTest method setUp.

@BeforeEach
void setUp() {
    memoryPool = new MemoryPools().pool(MemoryGroup.TRANSACTION, 0L, null);
    memoryTracker = new LocalMemoryTracker(memoryPool);
    forsetiLockManager = new ForsetiLockManager(Config.defaults(), Clocks.nanoClock(), ResourceTypes.values());
}
Also used : MemoryPools(org.neo4j.memory.MemoryPools) LocalMemoryTracker(org.neo4j.memory.LocalMemoryTracker) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 17 with LocalMemoryTracker

use of org.neo4j.memory.LocalMemoryTracker in project neo4j by neo4j.

the class PageCacheRule method getPageCache.

/**
 * Opens a new {@link PageCache} with the provided file system and config.
 *
 * @param factory {@link PageSwapperFactory} to use for the {@link PageCache}.
 * @param overriddenConfig specific {@link PageCacheConfig} overriding config provided in {@link PageCacheRule}
 * constructor, if any.
 * @return the opened {@link PageCache}.
 */
public PageCache getPageCache(PageSwapperFactory factory, PageCacheConfig overriddenConfig) {
    closeExistingPageCache();
    var memoryTracker = new LocalMemoryTracker();
    MemoryAllocator mman = MemoryAllocator.createAllocator(parse(selectConfig(baseConfig.memory, overriddenConfig.memory, "8 MiB")), memoryTracker);
    if (clock == null) {
        clock = Clocks.nanoClock();
    }
    MuninnPageCache.Configuration configuration = MuninnPageCache.config(mman).memoryTracker(memoryTracker).clock(clock);
    Integer pageSize = selectConfig(baseConfig.pageSize, overriddenConfig.pageSize, null);
    configuration = pageSize == null ? configuration : configuration.pageSize(pageSize);
    PageCacheTracer cacheTracer = selectConfig(baseConfig.tracer, overriddenConfig.tracer, PageCacheTracer.NULL);
    configuration = configuration.pageCacheTracer(cacheTracer);
    initializeJobScheduler();
    pageCache = new MuninnPageCache(factory, jobScheduler, configuration);
    pageCachePostConstruct(overriddenConfig);
    return pageCache;
}
Also used : MemoryAllocator(org.neo4j.io.mem.MemoryAllocator) MuninnPageCache(org.neo4j.io.pagecache.impl.muninn.MuninnPageCache) LocalMemoryTracker(org.neo4j.memory.LocalMemoryTracker) PageCacheTracer(org.neo4j.io.pagecache.tracing.PageCacheTracer)

Example 18 with LocalMemoryTracker

use of org.neo4j.memory.LocalMemoryTracker in project neo4j by neo4j.

the class HeapTrackingLongHashSetTest method setUp.

@BeforeEach
void setUp() {
    memoryPool = new MemoryPools().pool(MemoryGroup.TRANSACTION, 0L, null);
    memoryTracker = new LocalMemoryTracker(memoryPool);
}
Also used : MemoryPools(org.neo4j.memory.MemoryPools) LocalMemoryTracker(org.neo4j.memory.LocalMemoryTracker) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 19 with LocalMemoryTracker

use of org.neo4j.memory.LocalMemoryTracker in project neo4j by neo4j.

the class HeapTrackingLongObjectHashMapTest method setUp.

@BeforeEach
void setUp() {
    memoryPool = new MemoryPools().pool(MemoryGroup.TRANSACTION, 0L, null);
    memoryTracker = new LocalMemoryTracker(memoryPool);
}
Also used : MemoryPools(org.neo4j.memory.MemoryPools) LocalMemoryTracker(org.neo4j.memory.LocalMemoryTracker) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 20 with LocalMemoryTracker

use of org.neo4j.memory.LocalMemoryTracker in project neo4j by neo4j.

the class HeapTrackingUnifiedIdentityHashingSetTest method setUp.

@BeforeEach
void setUp() {
    memoryPool = new MemoryPools().pool(MemoryGroup.TRANSACTION, 0L, null);
    memoryTracker = new LocalMemoryTracker(memoryPool);
}
Also used : MemoryPools(org.neo4j.memory.MemoryPools) LocalMemoryTracker(org.neo4j.memory.LocalMemoryTracker) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

LocalMemoryTracker (org.neo4j.memory.LocalMemoryTracker)30 Test (org.junit.jupiter.api.Test)19 BeforeEach (org.junit.jupiter.api.BeforeEach)9 MemoryPools (org.neo4j.memory.MemoryPools)8 MemoryTracker (org.neo4j.memory.MemoryTracker)7 ByteBuffer (java.nio.ByteBuffer)3 Path (java.nio.file.Path)2 EmptyMemoryTracker (org.neo4j.memory.EmptyMemoryTracker)2 Channel (io.netty.channel.Channel)1 ChannelInitializer (io.netty.channel.ChannelInitializer)1 BoltChannel (org.neo4j.bolt.BoltChannel)1 UnauthenticatedChannelProtector (org.neo4j.bolt.transport.pipeline.UnauthenticatedChannelProtector)1 UnsafeUtil.initDirectByteBuffer (org.neo4j.internal.unsafe.UnsafeUtil.initDirectByteBuffer)1 UnsafeUtil.newDirectByteBuffer (org.neo4j.internal.unsafe.UnsafeUtil.newDirectByteBuffer)1 FileSystemAbstraction (org.neo4j.io.fs.FileSystemAbstraction)1 PhysicalFlushableChannel (org.neo4j.io.fs.PhysicalFlushableChannel)1 StoreChannel (org.neo4j.io.fs.StoreChannel)1 MemoryAllocator (org.neo4j.io.mem.MemoryAllocator)1 MuninnPageCache (org.neo4j.io.pagecache.impl.muninn.MuninnPageCache)1 PageCacheTracer (org.neo4j.io.pagecache.tracing.PageCacheTracer)1