aliehsaeedii commented on code in PR #16554:
URL: https://github.com/apache/kafka/pull/16554#discussion_r2698971880


##########
streams/src/main/java/org/apache/kafka/streams/state/internals/InMemoryTimeOrderedKeyValueChangeBuffer.java:
##########
@@ -381,17 +383,19 @@ private void restoreBatch(final 
Collection<ConsumerRecord<byte[], byte[]>> batch
     @Override
     public void evictWhile(final Supplier<Boolean> predicate,
                            final Consumer<Eviction<K, Change<V>>> callback) {
-        final Iterator<Map.Entry<BufferKey, BufferValue>> delegate = 
sortedMap.entrySet().iterator();
+        final List<Map.Entry<BufferKey, BufferValue>> entries = new 
ArrayList<>(sortedMap.entrySet());

Review Comment:
   Could we keep the `Iterator`? The list is wasting memory and it was the 
reason for suggesting a smaller list for the `keysToDelete` rather of copying 
the whole sortedMap.



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

Reply via email to