My God. The statements to send messages cause memory leak. I should use the
following statements instead.
Message message = m_handler.obtainMessage();
message.what = 1;
message.what = obj;
message.sendToTarget();
--- 10年5月21日,周五, Jiang <[email protected]> 写道:
发件人: Jiang <[email protected]>
主题: [android-developers] Memory leaks???
收件人: [email protected]
日期: 2010年5月21日,周五,上午11:50
1, In a thread, I send a gread many of messages with followign statements:
Message message = new Message();
message.what = 1;
message.what = obj;
m_handler.sendMessage(message)
message = null;
2, In a acvity
class MyActivity extends Activity
{
class MyHandler extends Handler
{
public void handleMessage(Message msg)
{
handleActivityMessage(msg);
}
}
public handleActivityMessage(Message msg)
{
....
}
}
When returned from MyActivity, System.gc() is called, but I found the memory
usage grows compared to the stage before entering MyActivity, does memory leak
during message processing?
Thanks.
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en