m1a2st commented on code in PR #18391:
URL: https://github.com/apache/kafka/pull/18391#discussion_r1904079189


##########
tools/src/main/java/org/apache/kafka/tools/ProducerPerformance.java:
##########
@@ -194,9 +195,16 @@ static List<byte[]> readPayloadFile(String 
payloadFilePath, String payloadDelimi
                 throw new IllegalArgumentException("File does not exist or 
empty file provided.");
             }
 
-            String[] payloadList = 
Files.readString(path).split(payloadDelimiter);
+            List<String> payloadList = new ArrayList<>();

Review Comment:
   Pardon me, it seems that reading a large file usually throws an 
`OutOfMemoryError`. However, I noticed that in your case, a 
`NegativeArraySizeException` was thrown instead. I would like to understand why 
this happens and how we can handle the NegativeArraySizeException when using an 
ArrayList.
   
   I think a base implmentation in ArrayList also an array.
   
https://github.com/openjdk/jdk/blob/f1d85ab3e61f923b4e120cf30e16109e04505b53/src/java.base/share/classes/java/util/ArrayList.java#L139



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