I am specifically asking about this paragraph in the Android documentation:
If the object you pass is for some reason tied to the
Activity/Context, you will leak all the views and resources of the
activity.
You can find this paragraph on the page about Faster Screen Orientation changes.
I assume they mean objects that keep a reference to the Activity/Context. In my Activity, I am returning a HashMap in onRetainNonConfigurationInstance, so I assume I am fine, since none of the objects in that HashMap contain references to the Activity/Context. But I want to make sure; I am still learning about how leaks happen in Android.
Patrick Dubroy has shown a video tutorial doing showing something similar. Then he proceeds to debug that leak. I guess you can follow the same procedure to confirm if your code is really leaky or not.
You are right, if the objects keep a reference to the Activity or Context, it won’t allow the GC to collect those unused Activities, thus create a huge leaks.