
Kotlin Development for Android – The Good, the Bad, the Ugly - philippb
https://medium.com/keepsafe-engineering/kotlin-the-good-the-bad-and-the-ugly-bf5f09b87e6f#.fx7t47ady
======
brendanw
"Where did the memory leaks come from? In order to implement VectorDrawable
inflation, the support library authors needed to update the way
Context.getDrawable is implemented. But that function is final, so they had to
make every View create a new copy of a Resources wrapper that could handle
VectorDrawables. Besides being a large amount of work, this caused the various
wrapped Resources to become out of sync, and to use a large amount of memory
due to the duplication. If that function wasn’t final, that mess wouldn’t have
happened."

Yup yup yup. Best practices are guidelines, not law.

~~~
on_and_off
Maybe it made sense at the time to make the function final to make it run a
little bit faster ? This is framework code where some aggressive optimizations
can be justified. It also made sense to limit what people could do with this
function .. it was not intented to be hacked around.

Finally, it was not a memory leak but a big increase in memory useage.

It is kinda sad that we still have to support API < 21 phones and IMO that's
the real issue here.

