Is this a true "leak"? Maybe I'm naive but I would think you couldn't have a leak without using JNI. Maybe a reference cycle is hard/impossible to GC? >Later, in a background thread, it checks if the reference has been cleared and if not it triggers a GC. > If the reference is still not cleared ... Sounds to me like it's not a leak so much as unbounded-memory-growth. But sounds like a useful tool. And I guess you can…
-Make a screen rotation and persist that object.
-During the rotation, the Activity reaches the end of its lifecycle and a new one is created.
-The retained object keeps a reference to its Activity. It should be collectable by the GC by now but it is not possible because of this object holding a strong reference to it. It does not stop here, the Activity almost certainly contains references to many other objects that similarly cannot be reclaimed.
It might not be very similar to the leaks encountered in c/c++ but it is very easy to create such issues in GC languages such as Java.