Skip to content

Commit 4068545

Browse files
fix(s3stream): fix buffer leak (AutoMQ#1948)
Signed-off-by: SSpirits <admin@lv5.moe>
1 parent 77161bb commit 4068545

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

s3stream/src/main/java/com/automq/stream/s3/wal/impl/object/ObjectWALService.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@
4949

5050
public class ObjectWALService implements WriteAheadLog {
5151
private static final Logger log = LoggerFactory.getLogger(ObjectWALService.class);
52+
private static final ByteBufSeqAlloc BYTE_BUF_ALLOC = new ByteBufSeqAlloc(S3_WAL, 8);
5253

53-
protected ByteBufSeqAlloc byteBufAlloc = new ByteBufSeqAlloc(S3_WAL, 8);
5454
protected ObjectStorage objectStorage;
5555
protected ObjectWALConfig config;
5656

@@ -88,7 +88,7 @@ public WALMetadata metadata() {
8888

8989
@Override
9090
public AppendResult append(TraceContext context, ByteBuf data, int crc) throws OverCapacityException {
91-
ByteBuf header = byteBufAlloc.byteBuffer(RECORD_HEADER_SIZE);
91+
ByteBuf header = BYTE_BUF_ALLOC.byteBuffer(RECORD_HEADER_SIZE);
9292
assert header.refCnt() == 1;
9393

9494
final CompletableFuture<AppendResult.CallbackResult> appendResultFuture = new CompletableFuture<>();

0 commit comments

Comments
 (0)