Fix inconsistent null handling between array and single object version RAM estimation#16296
Fix inconsistent null handling between array and single object version RAM estimation#16296timgrein wants to merge 4 commits into
Conversation
…n for Accountable in RamUsageEstimator.
|
I cannot add people as reviewers unfortunately. @ChrisHegarty can you maybe take a look? |
|
Did you encounter this in a real situation, or why the need to allow null? ( I'm just raising the question as I believe this api has been like this for a long time, and want to know if it's a real issue or just for consistency's sake ) |
@ChrisHegarty Yes I encountered it while working on a new CircuitBreaker for the inference API in Elasticsearch, where I've used it for RAM estimation. It felt inconvenient that I had to include a null-check, when I'm working with a single |
When checking an array of
Accountablethere's an explicitnullcheck avoiding NPEs, which would happen, when callingaccountable.ramBytesUsed().For the single object version
sizeOf(Accountable accountable)this is not the case, therefore aligning the implementations.