I find it funny on Windows, Android studio reaches as much as 12GB of ram usage, while on Linux two instances barely take up to 3GB

Either java sucks on Windows or AS sucks in memory usage but happened to be saved by Linux

  • 17
    I actually think its the second one.
    If I recall correctly,
    Linux uses optimistic memory management.
    Meaning if a program mallocs something but doesn't use the memory there, it is only allocated in software, not in hardware.
    So even if AS allocates a fuckton of memory for caching and everything,
    If it doesn't use it, it stays free and usable for other processes.
  • 5
    @metamourge that's something new I learned today, thank you :)

    If you don't mind asking, I sometimes reach a point where Android Studio stops responding to keyboard at all, no key click will do anything I searched for it and someone said it is related to not receiving signals due to driver bug?

    But it only happens in Android studio so I'm not sure
  • 5
    @metamourge you recall correctly.
    Look at htop. "VIRT" vs "RES". VIRT is what the program allocates, RES is what's actually used.
  • 3
    @irene I like to blame Java, but that's just some noob execution that is not backed up by anything. Just hate memory management when dealing with Java
  • 1
    @irene Ya you remind me, I used to use Community edition and had no issues, not sure why AS is like that ...
  • 3
    @gitpush interesting. It's the thing I love when dealing with Java :)

    Try comparing jvm stats (heap usage) on Lin and Win. I guess you'll see a vast difference there ;)

    This will rule out OS memory mgmt nuances
  • 1
    Optimistic memory can actually be abused in macos and Linux to create memory ballasts, decreasing the aggressiveness of the GC. Search for golang ballast.
  • 0
    Empty ram is wasted ram.
  • 0
    @Techno-Wizard Which is why you shouldn't run everything you find on the internet.
Add Comment