Leak Canary is an Android and Java library used to detect leak in the application
You can see the example in link below
https://github.com/square/leakcanary