I have a service that is opened by an Activity for the purposes of
managing a SQLite database the service is passed the application
context when binding...

serviceIntent = new Intent(getApplicationContext(),
DatabaseService.class);
bindService(serviceIntent, mConnection, Context.BIND_AUTO_CREATE);

The service is unbound in onPause


When trying to track down memory leaks with the Binders, I opened and
closed the activity a few times and then dumped the heap into MAT in
Eclipse.

Amongst all the other rubbish I get details as below.

Is this telling me that I actually have 4 different Application
Context instances at four different addresses??? Or am I just getting
different pointers to the one Application Context -they all come from
the same call for getApplicationContext(). I didn't think an app would
have more than one Application Context,IF this is what this means. Is
this something I should not be worried about?

This is from a single run of my app on fresh run of the emulator.


Class
Name
| Shallow Heap | Retained Heap
-------------------------------------------------------------------------------------------------------------------

com.ozdroid.database.DatabaseService @
0x43c9cc60                                              |          56
|         1,608
    |- mOuterContext android.app.ApplicationContext @
0x43c9cc98                             |        120 |           152
    |- this$0 com.ozdroid.database.DatabaseService$LocalBinder @
0x43c9da50 Native Stack|  32 |         1,640
'- Total: 2 entries

com.ozdroid.database.DatabaseService @
0x43c685e8                                   |                56 |
1,088
 | - mOuterContext android.app.ApplicationContext @
0x43c68620                        |            120 |      152
 |- this$0 com.ozdroid.database.DatabaseService$LocalBinder @
0x43c68c78 Native Stack| 32 |   1,120
'- Total: 2 entries

com.ozdroid.database.DatabaseService @
0x43c4c760                                   |                  56
|    432
 |- this$0 com.ozdroid.database.DatabaseService$LocalBinder @
0x43c3d6a0 Native Stack|   32 |     32
 |- mOuterContext android.app.ApplicationContext @
0x43c4c798                        |              120 |    152
 |- mDbS com.ozdroid.load.LoadView @
0x43cafea0                                      |          288
|         5,216
'- Total: 3 entries

com.ozdroid.database.DatabaseService @
0x43c42840                                   |                  56 |
1,088
 |- mOuterContext android.app.ApplicationContext @
0x43c42878                        |              120 |     152
 |- this$0 com.ozdroid.database.DatabaseService$LocalBinder @
0x43c44a60 Native Stack|   32 |  1,120
'- Total: 2 entries
 
|              |
Total: 4
entries
|              |
-------------------------------------------------------------------------------------------------------------------

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en

Reply via email to