Can LeakCanary be used on a non Android application? For example, in a JavaFx application?
The short answer is no it can't.
The LeakCanary documentation site says this:
LeakCanary’s knowledge of the internals of the Android Framework gives it a unique ability to narrow down the cause of each leak, helping developers dramatically reduce
OutOfMemoryError
crashes.
From this, we infer that it is the tool's knowledge of Android that is what distinguishes it from a generic leak detector.
Then we look at the source code repo on Github, there are a number of directories in the source tree for Android support, but nothing obvious that provides support for any other frameworks (Swing, JavaFX, SWT, etc).
Finally, LeakCanary support for JavaFX has been requested on the project's issue tracker, and the request has been declined as "not a priority".
It is not inconceivable that someone could apply the approach used by LeakCanary to other frameworks. Or even extend LeakCanary to support other frameworks. But there is no sign anyone has done this. (That I can find.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With