News for hackers. Stuff that matters.
Re:Android phone hits 24GB of RAM, as much as a 13-inch MacB... by LASR on Thursday July 06, 2023 @06:44PM (#36624291)
Without starting a flame war, can we have a proper discussion on Android and iOS memory management?

It seems like iOS and macOS do more with less ram. Why is that?

My outdated view on this is that iOS apps are native vs Android that runs JVM apps. Is that even true still?

Re:Android phone hits 24GB of RAM, as much as a 13-inch MacB... by palata on Thursday July 06, 2023 @07:11PM (#36624597)
Android doesn't run the JVM, but rather the ART (Android Runtime). It does AOT (ahead-of-time) optimization, which apparently helps a lot.

Still I can imagine that it uses slightly more memory...

Re:Android phone hits 24GB of RAM, as much as a 13-inch MacB... by Saris on Thursday July 06, 2023 @07:48PM (#36624967)
Android also runs multiple apps at once, IIRC iOS only runs the app in the foreground.
Re:Android phone hits 24GB of RAM, as much as a 13-inch MacB... by LoganDark on Thursday July 06, 2023 @08:42PM (#36625448)
> It seems like iOS and macOS do more with less ram. Why is that?

AFAIK, Android caches things in terms of the JVM/ART using Zygote, but macOS and iOS are designed to run native code, so they cache the actual dynamic libraries themselves (it's called the "dyld shared cache"). Things like libc, some core frameworks and so on go in there.

Keep in mind this happens across the entire OS, since the Android user experience is implemented largely in terms of high level JVM/ART objects with all of their associated heap overhead, but iOS and macOS and their apps are mainly implemented in C/C++, Swift, Objective-C, which at most use reference counting, and only for objects that need to be reference counted. This is absolutely not the cause of all memory issues but this is sort of the base level foundational stuff of both platforms and has implications for the higher levels.

Even though Android is based on Linux and iOS/macOS are based on Unix and BSD, and those two/three platforms are quite similar conceptually, they have very different userlands.

Re:Android phone hits 24GB of RAM, as much as a 13-inch MacB... by iudqnolq on Sunday July 09, 2023 @01:20PM (#36656424)
I get why refcounting could in theory sometimes have less latency than a highly tuned gc. But I don't see how it could possibly be lower memory. Can you explain?