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 3990722
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T06:31:45+00:00 2026-05-20T06:31:45+00:00

While investigating memory issues in our application, it turns out that if the application

  • 0

While investigating memory issues in our application, it turns out that if the application Activity is a MapActivity, the first instance of it won’t be finalized. Leading to other memory leak such as the view passed to setContentView.

Does anyone notice that before?

Here is the testing code showing that “MainActivity : 1” is not finalized whereas it is if MainActivity inherits from Activity.

To test, one needs to change device or emulator orientation many times.


import com.google.android.maps.MapActivity;
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;

public class MainActivity extends MapActivity {
  private static final String  defaultTag          = "MA";

  private static final boolean isDebugModeActivate = true;
  private static final boolean isClassTagDisplayed = false;
  private static final boolean isWebModeActivate   = false;

  static public void d(Object thiso, String message)
  {
      String tag = defaultTag + (isClassTagDisplayed == true ? "_" + thiso.getClass().getSimpleName() : "");
      message = (isClassTagDisplayed == false ? thiso.getClass().getSimpleName() + " : " : "") + message;
      Log.d(tag, message);
  }

  public MainActivity()
  {
    counter++;
    uid++;
    id = uid;
    d(this, id + " tst constructor (" + counter + ")");
  }
  private static int counter = 0;
  private static int uid = 0;
  private final int id;

  protected void finalize() throws Throwable
  {
    counter--;
    d(this, id + " tst finalize (" +counter + ") ");
    super.finalize();
  }

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
    }

    @Override
    protected boolean isRouteDisplayed()
    {
      return false;
    }
}

Thank you,
David

  • 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-20T06:31:46+00:00Added an answer on May 20, 2026 at 6:31 am

    Perhaps you should exchange notes with NickT here

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

Sidebar

Related Questions

While investigating an issue with application I'm working on, I've came across one behavior
I'm investigating a stack trace (seen while debugging) that looks something like the following:
While investigating a reported problem with my site loading slowly, I came across an
I have been looking at monotorrent and while investigating the whole bittorrent thing I
While I was investigating a problem I had with lexical closures in Javascript code,
Been investigating for a while now and keep hitting a brick wall. I am
Summary I have written a process monitor command-line application that takes as parameters: The
I am experiencing a crash, and while investigating I found myself totally blocked by
I've got an application that uses performance counters, that has worked for months. Now,
I'm currently investigating a bug that causes a windows to freeze up. After the

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.