Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -402,11 +402,20 @@ public long ramBytesUsed() {
List<Int2ObjectHashMap<int[]>> inMemoryNeighborsLocal = inMemoryNeighbors.get();

long inMemoryNeighborsBytes = RamUsageEstimator.NUM_BYTES_OBJECT_REF;
for (Int2ObjectHashMap<int[]> neighbors : inMemoryNeighborsLocal) {
inMemoryNeighborsBytes += neighbors.values().stream().mapToLong(is -> Integer.BYTES * (long) is.length).sum();
inMemoryNeighborsBytes += RamUsageEstimator.NUM_BYTES_OBJECT_REF;
if (inMemoryNeighborsLocal != null) {
for (Int2ObjectHashMap<int[]> neighbors : inMemoryNeighborsLocal) {
if (neighbors != null) {
inMemoryNeighborsBytes += neighbors.values().stream().mapToLong(is -> Integer.BYTES * (long) is.length).sum();
}
inMemoryNeighborsBytes += RamUsageEstimator.NUM_BYTES_OBJECT_REF;
}
}

Int2ObjectHashMap<FusedFeature.InlineSource> inMemoryFeaturesLocal = inMemoryFeatures.get();
long inMemoryFeaturesBytes = 0;
if (inMemoryFeaturesLocal != null) {
inMemoryFeaturesBytes = inMemoryFeaturesLocal.values().stream().mapToLong(is -> Integer.BYTES * is.ramBytesUsed()).sum();
}
long inMemoryFeaturesBytes = inMemoryFeatures.get().values().stream().mapToLong(is -> Integer.BYTES * is.ramBytesUsed()).sum();
inMemoryFeaturesBytes += RamUsageEstimator.NUM_BYTES_OBJECT_REF;

return Long.BYTES + 6 * Integer.BYTES + RamUsageEstimator.NUM_BYTES_OBJECT_REF
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,7 @@ public void testV0Read() throws IOException {
var onDiskGraph = OnDiskGraphIndex.load(readerSupplier);
var onDiskView = onDiskGraph.getView())
{
assertEquals(88, onDiskGraph.ramBytesUsed()); // Current size of graph that hasn't been read from
assertEquals(32, onDiskGraph.getDegree(0));
assertEquals(2, onDiskGraph.version);
assertEquals(100_000, onDiskGraph.size(0));
Expand Down
Loading