use of org.neo4j.memory.MemoryTracker in project neo4j by neo4j.
the class HeapTrackingLongEnumerationList method create.
public static <V> HeapTrackingLongEnumerationList<V> create(MemoryTracker memoryTracker, int chunkSize) {
Preconditions.requirePowerOfTwo(chunkSize);
MemoryTracker scopedMemoryTracker = memoryTracker.getScopedMemoryTracker();
scopedMemoryTracker.allocateHeap(SHALLOW_SIZE + SCOPED_MEMORY_TRACKER_SHALLOW_SIZE);
return new HeapTrackingLongEnumerationList<>(scopedMemoryTracker, chunkSize);
}
use of org.neo4j.memory.MemoryTracker in project neo4j by neo4j.
the class EagerBuffer method createEagerBuffer.
public static <T extends Measurable> EagerBuffer<T> createEagerBuffer(MemoryTracker memoryTracker, int initialChunkSize, int maxChunkSize, IntUnaryOperator growthStrategy) {
MemoryTracker scopedMemoryTracker = memoryTracker.getScopedMemoryTracker();
scopedMemoryTracker.allocateHeap(SHALLOW_SIZE + SCOPED_MEMORY_TRACKER_SHALLOW_SIZE + shallowSizeOfInstance(IntUnaryOperator.class));
return new EagerBuffer<T>(scopedMemoryTracker, initialChunkSize, maxChunkSize, growthStrategy);
}
use of org.neo4j.memory.MemoryTracker in project neo4j by neo4j.
the class HeapTrackingOrderedAppendMap method getIfAbsentPutWithMemoryTracker.
/**
* Get and return the value in the Map at the specified key. Alternatively, if there is no value in the map for that key
* return the result of evaluating the specified Function given the internal scoped memory tracker, and put that value in the
* map at the specified key.
*
* @param key The key to look up or insert a new value for
* @param function A function that takes a memory tracker and returns a value.
* @return The value for the given key
*/
public V getIfAbsentPutWithMemoryTracker(K key, Function<MemoryTracker, ? extends V> function) {
return map.getIfAbsentPutWith(key, p -> {
MemoryTracker memoryTracker = scopedMemoryTracker;
V value = p.valueOf(memoryTracker);
addToBuffer(key, value);
return value;
}, function);
}
use of org.neo4j.memory.MemoryTracker in project neo4j by neo4j.
the class HeapTrackingOrderedAppendMap method createOrderedMap.
public static <K, V> HeapTrackingOrderedAppendMap<K, V> createOrderedMap(MemoryTracker memoryTracker) {
MemoryTracker scopedMemoryTracker = memoryTracker.getScopedMemoryTracker();
scopedMemoryTracker.allocateHeap(SHALLOW_SIZE + SCOPED_MEMORY_TRACKER_SHALLOW_SIZE);
return new HeapTrackingOrderedAppendMap<>(scopedMemoryTracker);
}
use of org.neo4j.memory.MemoryTracker in project neo4j by neo4j.
the class LongProbeTable method createLongProbeTable.
public static <V extends Measurable> LongProbeTable<V> createLongProbeTable(MemoryTracker memoryTracker) {
MemoryTracker scopedMemoryTracker = memoryTracker.getScopedMemoryTracker();
scopedMemoryTracker.allocateHeap(SHALLOW_SIZE + SCOPED_MEMORY_TRACKER_SHALLOW_SIZE);
return new LongProbeTable<>(scopedMemoryTracker);
}
Aggregations