Copilot commented on code in PR #10772:
URL: https://github.com/apache/ozone/pull/10772#discussion_r3584363067
##########
hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/snapshot/defrag/TestSnapshotDefragService.java:
##########
@@ -224,6 +235,83 @@ private String getFromCodecBuffer(CodecBuffer buffer) {
return StringCodec.get().fromCodecBuffer(buffer);
}
+ private void putString(Table<String, CodecBuffer> table, String key,
+ String value) throws RocksDatabaseException, CodecException {
+ table.put(key, StringCodec.get().toDirectCodecBuffer(value));
+ }
Review Comment:
`putString` allocates a direct `CodecBuffer` via
`StringCodec.get().toDirectCodecBuffer(value)` and passes it to
`table.put(...)` without ever closing it. Since `CodecBuffer` is off-heap, this
can leak direct memory across test runs (and it isn’t tracked in `closeSet`
like `getCodecBuffer`). Close the buffer after the put (assuming `Table.put`
copies the bytes, which is how `CodecBuffer` is typically used throughout the
codebase).
--
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]