![]() If the weak reference held by ObjectWatcher is not cleared by the GC after 5 seconds, the watched object is considered retained, and potentially leaking. Then these objects are passed to a specific object called ObjectWatcher, which holds weak references to them. LeakCanary hooks into the Android lifecycle and detects when activities and fragments are destroyed and should be garbage collected. Once installed, LeakCanary automatically detects and reports memory leaks in 4 steps: You can now launch your app and confirm that LeakCanary is running by filtering on the LeakCanary tag in Logcat:ĭ LeakCanary: LeakCanary is running and ready to detect leaks It’s a ”plug & play” kind of library where the only thing you need to do is to add the leakcanary-android dependency to your app’s adle file: LeakCanary is a memory leak detection library for Android, developed by Square. An icon for each garbage collection event.A dashed line indicates the number of allocated objects, as indicated by the y-axis on the right. ![]() A stacked graph of how much memory is being used by each memory category, as indicated by the y-axis on the left and the colour key at the top.The memory use timeline, which includes the following:. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |