Call `compressor.close()` to fix memory leak

This commit is contained in:
Ismael Juma 2016-05-14 04:04:15 +01:00
parent 5311e5b10f
commit 515040ba45
1 changed files with 5 additions and 1 deletions

View File

@ -147,7 +147,11 @@ public final class Record {
// construct the compressor with compression type none since this function will not do any
//compression according to the input type, it will just write the record's payload as is
Compressor compressor = new Compressor(buffer, CompressionType.NONE);
compressor.putRecord(timestamp, key, value, type, valueOffset, valueSize);
try {
compressor.putRecord(timestamp, key, value, type, valueOffset, valueSize);
} finally {
compressor.close();
}
}
public static void write(Compressor compressor, long crc, byte attributes, long timestamp, byte[] key, byte[] value, int valueOffset, int valueSize) {