Skip to content

Commit a0a7c2c

Browse files
committed
Only point to :leak-detection Leiningen profile for enabling
Since this should be the overwhelmingly common way to enable the detector, we don't need to explain how to enable it manually. Looking at the profile itself should be sufficient to understand which settings are needed. Also, this way there's less of a chance for the profile and the docstring to diverge over time. Also, provide more context in the init log in case the logger doesn't print the current namespace by default.
1 parent 80b0770 commit a0a7c2c

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

test/aleph/resource_leak_detector.clj

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,7 @@
77
intentional presence of leaks and to check for unintended leaks. The main API entry points for
88
this are `with-leak-collection`, `with-expected-leaks` and `instrument-tests!`.
99
10-
To enable it, pass `-Dio.netty.customResourceLeakDetector=aleph.resource_leak_detector` to the
11-
JVM. You will also have to pass `-Dio.netty.leakDetection.level=PARANOID`.
12-
13-
Most reliable results are achieved by also passing the following options:
14-
`-Dio.netty.leakDetection.targetRecords=1`
15-
`-Dio.netty.allocator.type=unpooled`
16-
17-
All of the above is also provided by the `:leak-detection` Leiningen profile.
10+
To enable it, use the `:leak-detection` Leiningen profile.
1811
1912
NOTE: Currently only improves reliability for detecting leaked ByteBufs. Other types of leaked
2013
resources will still be detected but not with the same reliability. Search Netty's codebase for
@@ -58,7 +51,7 @@
5851
"Enable Netty debug logging to diagnose the cause.")))
5952
(throw (RuntimeException.
6053
(str "Attempted to use `aleph.resource-leak-detector` API but it is not enabled. "
61-
"Pass `-Dio.netty.customResourceLeakDetector=aleph.resource_leak_detector` to enable.")))))
54+
"To enable it, use the `:leak-detection` Leiningen profile.")))))
6255
(when-not (= ResourceLeakDetector$Level/PARANOID (ResourceLeakDetector/getLevel))
6356
(throw (RuntimeException.
6457
(str "`aleph.resource_leak_detector` requires `-Dio.netty.leakDetection.level=PARANOID`. "
@@ -205,6 +198,6 @@
205198
(alter-meta! tv update :test instrument-test-fn))))))
206199

207200
(if (enabled?)
208-
(log/info "enabled.")
209-
(log/info "disabled. This means resource leaks will be reported less accurately."
210-
"Pass `-Dio.netty.customResourceLeakDetector=aleph.resource_leak_detector` to enable."))
201+
(log/info "aleph.resource-leak-detector enabled.")
202+
(log/info "aleph.resource-leak-detector disabled. This means resource leaks will be reported less accurately."
203+
"To enable it, use the `:leak-detection` Leiningen profile."))

0 commit comments

Comments
 (0)