Reputation: 1045
I have a problem here. I have a Service which calls an activity to perform an action. The activity is called randomly or pre-defined time period.
But the RAM usage increases by 2-3 MB every time the activity is called.
This is how i call the activity from the Service,
Intent callIntent = new Intent(Intent.ACTION_CALL);
callIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
callIntent.setClass(getBaseContext(),CustomDialog.class);
startActivity(callIntent);
Upvotes: 0
Views: 154
Reputation: 1007658
Most likely, that is because you are creating new instances of your activity each time. Either use FLAG_ACTIVITY_REORDER_TO_FRONT
instead of FLAG_ACTIVITY_NEW_TASK
, or make sure that your old activity instances get destroyed at some point (e.g., user pressing BACK or you calling finish()
).
You are welcome to get a heap dump from DDMS, examine it in MAT, and determine specifically where your problem lies.
Upvotes: 1