use of org.apache.ignite.internal.mem.DirectMemoryProvider in project ignite by apache.
the class MetadataStorageSelfTest method memory.
/**
* @param clean Clean flag. If {@code true}, will clean previous memory state and allocate
* new empty page memory.
* @return Page memory instance.
*/
protected PageMemory memory(boolean clean) throws Exception {
DirectMemoryProvider provider = new MappedFileMemoryProvider(log(), allocationPath);
MemoryPolicyConfiguration plcCfg = new MemoryPolicyConfiguration().setMaxSize(30 * 1024 * 1024).setInitialSize(30 * 1024 * 1024);
return new PageMemoryNoStoreImpl(log, provider, null, PAGE_SIZE, plcCfg, new MemoryMetricsImpl(plcCfg), true);
}
use of org.apache.ignite.internal.mem.DirectMemoryProvider in project ignite by apache.
the class PageMemoryNoLoadSelfTest method memory.
/**
* @return Page memory implementation.
* @throws Exception If failed.
*/
protected PageMemory memory() throws Exception {
File memDir = U.resolveWorkDirectory(U.defaultWorkDirectory(), "pagemem", false);
MemoryPolicyConfiguration plcCfg = new MemoryPolicyConfiguration().setMaxSize(MAX_MEMORY_SIZE).setInitialSize(MAX_MEMORY_SIZE);
DirectMemoryProvider provider = new MappedFileMemoryProvider(log(), memDir);
return new PageMemoryNoStoreImpl(log(), provider, null, PAGE_SIZE, plcCfg, new MemoryMetricsImpl(plcCfg), true);
}
use of org.apache.ignite.internal.mem.DirectMemoryProvider in project ignite by apache.
the class IgniteCacheDatabaseSharedManager method initMemory.
/**
* @param memCfg memory configuration with common parameters.
* @param plcCfg memory policy with PageMemory specific parameters.
* @param memMetrics {@link MemoryMetrics} object to collect memory usage metrics.
* @return Memory policy instance.
*/
private MemoryPolicy initMemory(MemoryConfiguration memCfg, MemoryPolicyConfiguration plcCfg, MemoryMetricsImpl memMetrics) {
File allocPath = buildAllocPath(plcCfg);
DirectMemoryProvider memProvider = allocPath == null ? new UnsafeMemoryProvider(log) : new MappedFileMemoryProvider(log, allocPath);
PageMemory pageMem = createPageMemory(memProvider, memCfg, plcCfg, memMetrics);
return new MemoryPolicy(pageMem, plcCfg, memMetrics, createPageEvictionTracker(plcCfg, pageMem));
}
Aggregations