摘要: 在用Handler时,我们使用Message对象时,google不推荐我们通过new Message()来构造一个Message对象,因为Message我们会频繁的使用,不断的new,导致内存碎片,效率不高。Google推荐我们通过obtain()方法构造,为什么了?obtain()内部是怎么实现构造Message从而避免频繁的new而造成的浪费?首先我们看看obtain()函数: 1 public static Message obtain() { 2 synchronized (sPoolSync) { 3 if (sPool != null... 阅读全文
posted @ 2013-08-10 13:36 小浪子kn 阅读(692) 评论(0) 推荐(0)