Skip to content

Commit

Permalink
Move RAM Usage to precomputed block (#11587)
Browse files Browse the repository at this point in the history
Signed-off-by: mgodwan <[email protected]>
  • Loading branch information
mgodwan authored Dec 12, 2023
1 parent 66d4e9e commit b5700b4
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
final class IndexVersionValue extends VersionValue {

private static final long RAM_BYTES_USED = RamUsageEstimator.shallowSizeOfInstance(IndexVersionValue.class);
private static final long TRANSLOG_LOC_RAM_BYTES_USED = RamUsageEstimator.shallowSizeOfInstance(Translog.Location.class);

private final Translog.Location translogLocation;

Expand All @@ -55,7 +56,7 @@ final class IndexVersionValue extends VersionValue {

@Override
public long ramBytesUsed() {
return RAM_BYTES_USED + RamUsageEstimator.shallowSizeOf(translogLocation);
return RAM_BYTES_USED + (translogLocation == null ? 0L : TRANSLOG_LOC_RAM_BYTES_USED);
}

@Override
Expand Down

0 comments on commit b5700b4

Please sign in to comment.