There is a common memory-leak issue of ViewPager2, to prevent this we can use viewLifeCycleOwner when creating the FragmentStateAdapter — There is a common memory-leak issue of ViewPager2, for example, through a large or unknown number of fragments, use FragmentStateAdapter with ViewPager2, and then navigate forward to a new fragment, Leak Canary detects memory leaks. Most of the solutions from Stack Overflow would set the adapter to null when onDestroyView():