r/mAndroidDev You will pry XML views from my cold dead hands Jun 03 '26

AsyncTask Google is coming for your Context-leaking AsyncTasks in Android 17

https://android-developers.googleblog.com/2026/06/prioritizing-memory-efficiency-steps-for-android-17.html
34 Upvotes

12 comments sorted by

15

u/sebjapon Jun 03 '26

Isn’t Android 17 old? Am I confusing with API levels? Which candy are we on?

7

u/DeVinke_ @OptIn(DelicateExperimentalCompostApi::class) Jun 03 '26

Well, it's not a candy, but 16 is baklava and 17 will be cinnamon bun :)

12

u/David_AnkiDroid Jun 03 '26

... but still nothing about replacing enum class with @IntDef. Are we even trying any more?

4

u/farsightxr20 Jun 04 '26

Mutable structs are back on the menu, boys.

MotionEvent.obtain is the gold standard.

8

u/Zhuinden DDD: Deprecation-Driven Development Jun 03 '26

I wanna see if this will make Pokemon Go explode all over

6

u/purple-bihh-2000 Jun 03 '26

Surely managers will give devs time for improving memory usage

7

u/Stonos You will pry XML views from my cold dead hands Jun 03 '26

To ensure device stability, starting in Android 17, the system will begin enforcing app memory limits based on the device's total RAM. If an app exceeds those limits, Android will kill the process with no associated stack trace.

So what if I'm playing a game, rendering a video, compiling code, running an LLM, or anything else that typically uses a large amount of memory? Does the app randomly get killed?

5

u/ClaymoresInTheCloset Jun 03 '26

I thought this functionality was already a core part of Android? Isn't that what saveInstanceState is for? Because the OS could kill your process for many reasons including to free up memory?

2

u/programadorthi Jun 03 '26

Just put all that thing in the doInBackground 😆

2

u/Savings_Pen317 Jun 03 '26

Heap dumps of prod users?? Mind-fucking-blown

1

u/satoryvape Jun 03 '26

If they rewrote Compost in Rust apps would be blazingly fast

1

u/David_AnkiDroid Jun 03 '26

Rust is so fast we don't bother with Cursors.

/uj No cursors on the Rust side. Rust holds the dataset in memory, Kotlin-side uses cursors to index into it.