jbellis commented on code in PR #12421:
URL: https://github.com/apache/lucene/pull/12421#discussion_r1290387939
##########
lucene/core/src/java/org/apache/lucene/util/hnsw/OnHeapHnswGraph.java:
##########
@@ -169,35 +170,43 @@ public NodesIterator getNodesOnLevel(int level) {
@Override
public long ramBytesUsed() {
+ // local vars here just to make it easier to keep lines short enough to
read
+ long AH_BYTES = RamUsageEstimator.NUM_BYTES_ARRAY_HEADER;
+ long REF_BYTES = RamUsageEstimator.NUM_BYTES_OBJECT_REF;
+
long neighborArrayBytes0 =
- nsize0 * (Integer.BYTES + Float.BYTES)
- + RamUsageEstimator.NUM_BYTES_ARRAY_HEADER
- + RamUsageEstimator.NUM_BYTES_OBJECT_REF * 2
- + Integer.BYTES * 3;
+ (long) nsize0 * (Integer.BYTES + Float.BYTES)
+ + AH_BYTES * 2
+ + REF_BYTES
+ + Integer.BYTES * 2;
Review Comment:
i don't think so, but it was missing 1 byte for the boolean. I've added
comments to clarify
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]