https://kotlinlang.org logo
#android-studio
Title
# android-studio
z

Zoltan Demant

10/05/2023, 9:33 AM
Has anyone else experienced pretty dramatic memory issues with Android Studio lately? The memory indicator sits happily at 2-6MB; Ive set the limit to 12MB, but my system tells me Android Studio uses up almost 40 MB. Im on the latest canary, but this has been happening for quite a while (months).
j

Jakub Syty

10/05/2023, 9:35 AM
Oh man, i wish android studio used 40 MB. Even 100. Even 500!
on the serious note - i assume you are talking about GB not MB
system tells you about virtual memory usage, it's not a physical RAM usage
My take on it - if it works for you, if you do not have any performance issues or crashes - is it really an issue?
RAM is there to use it
it's like chrome. Yes - it uses a lot of ram. but at the same time it is the fastest browser. So for me it's worth it. It's not like i need this ram for later
z

Zoltan Demant

10/05/2023, 9:40 AM
Whoops, yes GB 😄 And the usage unfortunately results in terrible UX; I can still code (mostly) fine but the emulator lags a ton.
j

Jakub Syty

10/05/2023, 9:49 AM
What is your machine?
emulator often lags for other reasons
and emulator probably won't show up in the same process as android studio
z

Zoltan Demant

10/05/2023, 9:52 AM
Maybe Im coming at this from the wrong perspective, its just that the high memory usage seems to 100% correlate with the lag. Ive rebooted to fix this a few times, but it seems that I can even just restart AS to fix it. The emulator is usually very fast for me, even in debug builds (Im working with compose). My machine runs Windows, i9 with 64GB RAM.
j

Jakub Syty

10/05/2023, 9:58 AM
hmm
maybe you gradle config/version/whatever makes some leak? I'm working on windows with 32 GB of RAM on really big projects and no such issues
z

Zoltan Demant

10/05/2023, 10:05 AM
Thats what Im used to as well! Which version of AS are you using? I wouldnt even know where to start looking for the leak in my case, Im sort of hoping that its just a generic issue with AS.. but I also think its been happening for far too long for that to be 100% true.
r

rocketraman

10/05/2023, 12:07 PM
The emulator is a different process than Android Studio, so if that is lagging, your system may just be short on memory. You may want to actually try limiting Studio's memory a bit more with a
-Xmx
parameter. In IntelliJ its under Help, Edit Custom VM Options... Not sure where it is in Studio.
j

Jakub Syty

10/05/2023, 12:10 PM
I'm always sticking with stable version, no need for unnecessary drama in my life 😄
@rocketraman with 64GB of ram this probably isn't an issue. And Zoltan said that he did limit the memory usage in settings (which is pretty much setting those flags)
r

rocketraman

10/05/2023, 12:16 PM
Right, I missed that. But at the end of the day his problem seems to be mostly with emulator, which really has nothing to do with Studio, except indirectly. He'll need to dig into Task Manager / Perfmon to perhaps get hints as to why emulator is lagging. If Studio is using 40 GB of virtual memory, and his system is paging, that could slow the emulator down a lot.
Also, what are the emulator device RAM sizes set to?
I have 128 GB of RAM on my system and I've had runaway processes use it all up. So 64 GB is no guarantee of available memory.
z

Zoltan Demant

10/05/2023, 12:30 PM
Emulator RAM is the default, Ive been using the same emulator for years ❤️ Maybe tweaking that will help, Ill check!
Thank you 😃 I had it set to 2048 MB, so I doubled it and its much smoother despite earlier problems. How much RAM have you allocated to the emulator yourselves?
r

rocketraman

10/05/2023, 1:00 PM
Mine is at the default and it seems to work ok 🤷
z

Zoltan Demant

10/05/2023, 1:45 PM
If it aint broken..? On the other hand, maybe it will work even better with an increase. Either way, happy and snappy here, thanks for all the help 🙂
👍 1
2 Views