One of the hardest parts of writing an Android application is dealing with images. They take up a lot of memory, and are a leading cause of crashes and slowdowns. This talk goes into the architecture of Android’s image processing libraries and how they have evolved over the years. It presents the different options available in the API for better image handling – bitmap recycling and pooling most prominently. I then go into more detail into work currently underway at Facebook to improve image handling. I discuss some poorly documented features in the Android SDK and NDK that offer keys to faster and safer image handling.
----- Meeting Notes (5/7/14 23:10) -----TeamWhat we've learned about images
----- Meeting Notes (5/7/14 23:10) -----Low-end devices 32 MB heap sizeCompressed vs uncompressed images4 bytes per pixelThe good/bad thing about Java is.Concurrent GCGC when it feels like, not when you need it.
----- Meeting Notes (5/7/14 23:10) -----Impact on UI threadImpact on user And if it fails...
----- Meeting Notes (5/7/14 23:10) -----Your app may not be doing anything 'wrong'
----- Meeting Notes (5/7/14 23:10) -----Android predicted this
----- Meeting Notes (5/7/14 23:10) -----SkiaBad because GC doesn't know when to triggerBad because images could crowd other apps out
AshmemAnonymous shared memoryKernel allocates pages and these can be mapped to user spaceUnpinned is reclaimed when needed
You can put intermediate bytes in native memory. More to avoid GC churn than to save memory.