Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6578351
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T15:45:35+00:00 2026-05-25T15:45:35+00:00

I have activity A, which launches activity B via an intent. Activity A has

  • 0

I have activity A, which launches activity B via an intent. Activity A has no references to Activity B, there are also no references to Activity B in the Application singleton I am using.

When I create Activity B, several thousand objects are created. That’s okay, it’s an activity with a very populated ListView with lots of images.

But, when I press the back button and return to Activity A, only about a dozen of the several thousand objects are released. onDestroy() is also called for the activity. I’m using DDMS to view the heap info, and am pressing ‘Cause GC’ several times to force it to free memory.

I’ve done the same test on other apps (that use list views too) and 100% of their objects are destroyed on pressing the back button then ‘Cause GC’, so it’s certainly not a bug.

Any advice please? 🙂 I’ve read the material in the android docs about leaking contexts, but that’s not helpful since i’m not referencing the activity (or anything in it) being destroyed elsewhere. Also, I have many other activities which work the same way, and don’t release all memory on destroy. I must be missing something obvious?

Edit: I just realized i’m using AsyncTasks which have references to the activity (either passed as arg into doInBackground() or accessible via outerClass.this. Could they be hanging around in the thread pool, even after onPostExecute() ?

Edit: It leaks even if I go back before running any asynctasks 🙁

Edit: No leak before running asynctasks if I remove admob code, but still leaks in the activites which do use asynctasks.. so asynctask is still a good candidate 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T15:45:36+00:00Added an answer on May 25, 2026 at 3:45 pm

    I believe there’s a bug in the ListView implementation. Take a look at this question: Android: AlertDialog causes a memory leak.

    Here’s a bug report: http://code.google.com/p/android/issues/detail?id=12334. It’s declined but in my opinion it must be reopened.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose I have something like an alarm activity which launches the alarm through the
I have an Activity which launches Dialer with specified number. After the user finishes
I have an activity which, onclick of a widget, launches another with a WebView.
I have a widget that launches an activity, but when the activity finishes using
I have a ListActivity which launches another Activity based on the list selection. This
I have an activity which shows some List entries. When I click on a
I have created an activity which sends a number of notifications to status bar.
I have a couple of tables which are used to log user activity for
Say if I have a locationManager(LM) object in activity A, which is my main
I have an activity that has a TabHost containing a set of TabSpecs each

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.