Because your modules didn't support custom scopes so memory leak is existing
Example:
class GetArticlesListUseCase @Inject constructor(private val articlesRepository: ArticlesRepository,
subscribeScheduler: Scheduler,
postExecutionScheduler: Scheduler) : UseCase<List, Unit>(subscribeScheduler, postExecutionScheduler) {
override fun buildUseCaseSingle(params: Unit?): Single<List> = articlesRepository.articles()
.map {
it.map { Article(it.title, it.pubDate, it.link) }
}
//I added some code at here to check memory leak by Profiler of Android Studio
var test: ByteArray? = null
init {
test = ByteArray(1024102450)
}
fun test() {
if (test != null) {
}
}
}
//Java memory in MEMORY tab from Profiler increases 50KB->100KB->150KB... whenever the app opens the activity which is using GetArticlesListUseCase
Because your modules didn't support custom scopes so memory leak is existing Example: class GetArticlesListUseCase @Inject constructor(private val articlesRepository: ArticlesRepository, subscribeScheduler: Scheduler, postExecutionScheduler: Scheduler) : UseCase<List, Unit>(subscribeScheduler, postExecutionScheduler) {
override fun buildUseCaseSingle(params: Unit?): Single<List> = articlesRepository.articles()
.map {
it.map { Article(it.title, it.pubDate, it.link) }
}
//I added some code at here to check memory leak by Profiler of Android Studio
var test: ByteArray? = null
init {
test = ByteArray(1024102450)
}
}
//Java memory in MEMORY tab from Profiler increases 50KB->100KB->150KB... whenever the app opens the activity which is using GetArticlesListUseCase