Possible Memory leak through FinalizerReference

There is likely no memory leak involving FinalizerReference in your app, although the Android Memory Profiler makes it look like there is.

My investigation of similar concerns convinced me that Profiler performs massive multiple counting of the same small amount of memory in the case of FinalizerReference, so that the reported value of Retained Memory is meaningless, and sometimes even ludicrous.

In your case, the ~38kB Shallow Size is important, but small, while the ~40 MB Retained Memory should be ignored.


For more details about your issue, look at the referent field of your Finalizer. Finalizer objects are just extended References, so you could investigate the content. It will give you information about the finalizing objects.

Depending on the content, you will have new leads. It is possible that the finalization process for the pending objects is very long. As you have only one thread processing them all, you may be somehow finalizing more than you can.

Cheers