Re-using Bitmaps (100 Days of Google Dev)

24 040
27.2
Следующее
Популярные
197 дней – 2 4130:58
What's it like being a GDSC Lead?
Опубликовано 1 августа 2015, 8:45
In modern mobile applications, Bitmaps can account for a large amount of memory churn. Constantly loading thumbnails, user icons, and Emoji sets can provide your users with a steady stream of media, but it can also contribute to some HUGE pauses for garbage collection.

In this video Colt McAnlis, and for temporally allocated bitmaps, there’s a handy trick that you absolutely should be using to escape these performance problems: Re-using bitmaps.

Every time you allocate a bitmap, you have to incur some overhead to allocate the objects from the heap, which is less than ideal if you’ve got a lot of bitmaps. Rather than banging on the heap for new objects each time, you can instead, reuse the memory that an existing bitmap has created, and load your image there.

The end result? Less memory churn from bitmaps.

Watch more Android Performance Patterns here: goo.gl/4ZJkY1

100 Days of Google Dev / 100 developer videos over 100 days / #GoogleDev100

Join the G+ Community here: goo.gl/g7mxmI

Subscribe to the Google Developers channel here: goo.gl/mQyv5L
Свежие видео
11 дней – 9690:27
Who's up next? 👀
12 дней – 1 155 4060:58
👀 Something Top Secret...
автотехномузыкадетское