Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is global message pool in Android? Where does it reside in memory?

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?

like image 346
arun8 Avatar asked Feb 12 '14 14:02

arun8


1 Answers

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.

like image 71
Laurent B Avatar answered Sep 20 '22 17:09

Laurent B