Can dagger cause high memory usage even on empty activity

Viewed 107

I've been trying to solve this issue on high memory usage. It happens only when I've had multiple execution in my android studio. So first to make sure, I uninstall the app then run android studio. The app will install and all is good. Waited for a while checking the memory profiler but got nothing. All is good. Memory usage was great. No reports on leak in LeakCanary and no garbage collection is called often. Then after a while of repeated running the app in android studio because I am developing it currently, I notice the app would crash after 2 min mark. I check the memory profiler and I was right, the memory usage skyrocketed on 1-2 min mark. I have no idea why this is. I check the heap dump and no leaks reported. Even Leak Canary reported 0 leaks. I was just doing some UI fixes thats it. To make sure it was not happening on my main activity, I created a fake activity with just four buttons and still the memory usage will skyrocket on 1-2 min. This has been a problem when I started using dagger 2. According to some article, using a custom scope can be expensive so I don't use any scope. My app is not complicated and I don't have any asynctask and I am not yet using any coroutine atm. Here are the images I got.enter image description here

Leak canary does not show anything leaks so Im quite baffled. I don't have any images on the activity as well. I implemented my dagger component on application level. My database is realm database, faster compared to room but I was not using it on my activity atm. Anyone had this issue like mine? Just wanted to know did you figure it out?

1 Answers

Thanks to Mark Keen's comment. Found the reason. It was the sentry.io calling okhttp. I remove it and the memory usage becomes stable.

Related