Take the 2-minute tour ×

I have successfully finished an android project's implementation and started to test the app for memory leaks. Sometimes, I get deadobject exception after a long trip in the app and all of the memory allocations are freed. How can I detect this problem? I have made some research about DDMS tools to detect memory leaks, Due to I have no idea about DeadObjectExeption, I don't know where to start.

Thanks in advance..

share|improve this question

1 Answer 1

This is not a memory leak problem. Definition of the memory leak (from Wikipedia):


Here, you have an opposite case - memory is freed before it should (at least from your program's point of view).

From developer.android.com:

DeadObjectException extends RemoteException


For example:

You have MyActivity and MyService classes. You use Handler/Messenger to communicate between them. You create Handler and Messenger in MyActivity, and then send created instance of Messenger to MyService via Intent. Then you do some stuff, time passes, and your MyActivity gets destroyed, together with it's Handler and Messenger. Now, if you don't handle that well, MyService won't know that Messenger that he has is not valid anymore, so, he tries to send something through it, and get DeadObjectexception:

/* Send a Message to this Messenger's Handler.


message The Message to send. Usually retrieved through Message.obtain().


RemoteException Throws DeadObjectException if the target Handler no longer exists.*/

public void send(Message message) throws RemoteException {...}

share|improve this answer

Your Answer


