Re-using Bitmaps
In fashionable cellular purposes, Bitmaps can account for a considerable amount of reminiscence churn. Always loading thumbnails, person icons, and Emoji units can present your customers with a gradual stream of media, however it might probably additionally contribute to some HUGE pauses for rubbish assortment.
On this video Colt McAnlis, and for temporally allotted bitmaps, there’s a useful trick that you just completely needs to be utilizing to flee these efficiency issues: Re-using bitmaps.
Each time you allocate a bitmap, you need to incur some overhead to allocate the objects from the heap, which is lower than best should you’ve bought loads of bitmaps. Quite than banging on the heap for brand spanking new objects every time, you may as an alternative, reuse the reminiscence that an present bitmap has created, and cargo your picture there.
The top end result? Much less reminiscence churn from bitmaps.
Android Coding