When I was looking up the functionality of Handler.obtainMessage(),
I read that it retrieves a message from global message pool instead of creating a new instance of message. Where does this global message pool reside?
Is it a collection of all the message objects that were created before?
It simply means that dalvik stores the messages in a pool of recycled objects. These are created and stored from a static pool thread:
private static Message sPool;
You won't have access directly to it, but you can still call methods such as recyle.
You can have a look at the source code here.
As for where exactly : the heap.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With