Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using LeakCanary on a non Android application

Can LeakCanary be used on a non Android application? For example, in a JavaFx application?

like image 934
Vanja Keglevic Avatar asked May 05 '17 10:05

Vanja Keglevic


1 Answers

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".

  • https://github.com/square/leakcanary/issues/1131

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.)

like image 51
Stephen C Avatar answered Oct 03 '22 23:10

Stephen C