From e53118798735e51e60b3778517404cf895435f64 Mon Sep 17 00:00:00 2001 From: garyschulte Date: Sat, 12 Nov 2022 11:42:05 -0800 Subject: [PATCH] use debugLambda to prevent unnecessary string parsing during GC if debug is not enabled Signed-off-by: garyschulte --- .../rocksdb/segmented/RocksDBSnapshotTransaction.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/plugins/rocksdb/src/main/java/org/hyperledger/besu/plugin/services/storage/rocksdb/segmented/RocksDBSnapshotTransaction.java b/plugins/rocksdb/src/main/java/org/hyperledger/besu/plugin/services/storage/rocksdb/segmented/RocksDBSnapshotTransaction.java index 47543fe3efa..dcfd61e2cb4 100644 --- a/plugins/rocksdb/src/main/java/org/hyperledger/besu/plugin/services/storage/rocksdb/segmented/RocksDBSnapshotTransaction.java +++ b/plugins/rocksdb/src/main/java/org/hyperledger/besu/plugin/services/storage/rocksdb/segmented/RocksDBSnapshotTransaction.java @@ -15,6 +15,8 @@ */ package org.hyperledger.besu.plugin.services.storage.rocksdb.segmented; +import static org.hyperledger.besu.util.Slf4jLambdaHelper.debugLambda; + import org.hyperledger.besu.plugin.services.exception.StorageException; import org.hyperledger.besu.plugin.services.metrics.OperationTimer; import org.hyperledger.besu.plugin.services.storage.KeyValueStorageTransaction; @@ -178,9 +180,10 @@ public void close() { @Override protected void finalize() { if (!isClosed.get()) { - LOG.debug( + debugLambda( + LOG, "RocksDBSnapshotTransaction was not closed. This is a memory leak. Stack trace: {}", - Arrays.toString(stackTrace)); + () -> Arrays.toString(stackTrace)); close(); } }