Handler

Handler 泄露时引用链条是:

Handler(msg.targe) -> Message -> MessageQueue -> Looper -> Thread

Message obtain

复用池,主要是减少缓存抖动,对于message可能大量创建销毁的情况,handler维护了pool链接,其中当Looper.loop中处理完message后,message会被recyle到pool中。

(类似的内存复用池,如glide的bitmappool)

Author

white crow

Posted on

2024-12-19

Updated on

2024-12-23

Licensed under