mayya-sharipova commented on code in PR #11743: URL: https://github.com/apache/lucene/pull/11743#discussion_r962072588
########## lucene/core/src/java/org/apache/lucene/util/hnsw/OnHeapHnswGraph.java: ########## @@ -175,20 +175,28 @@ public long ramBytesUsed() { long neighborArrayBytes0 = nsize0 * (Integer.BYTES + Float.BYTES) + RamUsageEstimator.NUM_BYTES_ARRAY_HEADER * 2 - + RamUsageEstimator.NUM_BYTES_OBJECT_REF; + + RamUsageEstimator.NUM_BYTES_OBJECT_REF + + Integer.BYTES * 2; long neighborArrayBytes = nsize * (Integer.BYTES + Float.BYTES) + RamUsageEstimator.NUM_BYTES_ARRAY_HEADER * 2 - + RamUsageEstimator.NUM_BYTES_OBJECT_REF; - + + RamUsageEstimator.NUM_BYTES_OBJECT_REF + + Integer.BYTES * 2; long total = 0; for (int l = 0; l < numLevels; l++) { int numNodesOnLevel = graph.get(l).size(); Review Comment: In comparison with what `RamUsageTester::ramUsed` reports, we are actually underestimating. I still need to do more investigation. Also, we preemptively allocate memory for all `NeighborArray` objects which may never get populated with real data. We probably need to look into this. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org