06/23/2022, 8:51 AM
Does cyclic reference in Android creates memory leak? I have one ViewModel and one Utility class. MyViewModel creates an instance of the utility class (Manager) and registers a callback. As per my understanding, this might create memory leak as these objects won't be garbage collected as their reference count will be always greater than 1. class Manager(private val listener: (String) -> Unit): BarCodeScanResult { fun launchSDK(activity: Activity) { // launches a activity to scan a bar code } override fun processResults(result:...