Walkthrough
Before starting the discussion about how to improve and profile our code, it's really important to understand how Android devices handle memory. Then, in the following pages we will analyze differences between the runtimes that Android uses, we will learn more about garbage collection, understand memory leaks and memory churns, and how Java handles object references.
How memory works
Have you ever thought about how a restaurant works? Let's think about it for a while: when new groups of customers get into the restaurant there's a waiter ready to search for a place to allocate them. But the restaurant is a limited space. So, there is a need to free tables when possible: that's why, when a group has finished eating, another waiter cleans and prepares the table for other groups to use. The first waiter has to find the table with the right number of seats for every new group. Then, the second waiter's task should be fast and shouldn't hinder or block...