uschindler commented on PR #13608:
URL: https://github.com/apache/lucene/pull/13608#issuecomment-2248785078

   > Something I found in an ES heap dump. For large numbers of `FieldReader` 
where the minimum term is an empty string, we allocate MBs worth of empty 
`byte[]` for larger nodes. Worth adding the conditional here to save some heap 
I think, allocating empty instances is also somewhat common in other scenarios.
   
   Normally the allocation of empty arrays is elided by the optimizer (under 
normal circumstances). So something like 'list.toArray(new array[0])` is 
optimized away and its basically a bad idea to allocate anything larger to fit 
list size.
   
   The problem here is that those arrays are long-living because they are 
packed into a BytesRef and the compiler can't figure out at runtime in an easy 
way that it is useless to allocate it at all.
   
   So I'd merge this and backport it to 9.x. Thanks.


-- 
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]

Reply via email to