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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T16:14:46+00:00 2026-06-04T16:14:46+00:00

I needed recently to test my app with Allocations because of memory warnings. Even

  • 0

I needed recently to test my app with Allocations because of memory warnings. Even there are no leaks, the heap keeps growing with annotations added to the map. Every time I zoom in or out, the old annotations are removed, new ones are created and added to the map :

enter image description here

All of the memory locations from the NumberedAnnotationView group show the marked line as the problematic in viewForAnnotation

- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation{
    static NSString *reuseId_big   = @"bigcircle";     
    NumberedCircleAnnotationView * nca = nil;
    //nca = (NumberedCircleAnnotationView *)[self.mapView dequeueReusableAnnotationViewWithIdentifier:reuseId_big];  
    if ( nca == nil )
        nca = [[[NumberedCircleAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:reuseId_big imageType:1] autorelease];  // THIS line
        nca.delegate = self;
    }
    return nca;
}

The init looks like this :

-(id)initWithAnnotation:(id<MKAnnotation>)annotation reuseIdentifier:(NSString *)reuseIdentifier imageType:(int)imageType {
    
    self = [super initWithAnnotation: annotation reuseIdentifier: reuseIdentifier];  // THIS line
    if (self != nil)
    {
     // set stuff 
    } 
    return self;
}

Even after minutes, these autoreleased objects are still there. ( 17 and 24 is the number of annotations displayed on map and removed with [mapView removeAnnotations:[mapView annotations]]; each time I zoom in/out.

The others, I think, are some MapKit generated stuff. I’m experiencing this in the simulator with versions 5.0 and 5.1.

How could I fix this ? Is something that I’m missing ? Or is this the normal behavior of Mapkit ?

Thanks!

  • 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-06-04T16:14:48+00:00Added an answer on June 4, 2026 at 4:14 pm

    Is there any reason you are not using the

    [mapView dequeueReusableAnnotationViewWithIdentifier:annotationIdentifier];
    

    method?

    Seems like you are creating view for your annotations every time!

    Check out this article:
    http://www.highoncoding.com/Articles/804_Introduction_to_MapKit_Framework_for_iPhone_Development.aspx

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

Sidebar

Related Questions

I recently needed to add a shutdown hook to a Scala app I have,
Till recently i've needed to run the dev environment for my Heroku (postgres) app
I have this app, originally written for iOS 2.x. I recently needed to add
While working in a Java app, I recently needed to assemble a comma-delimited list
I recently needed to create speech bubbles. To create the little triangular tip at
I'm developing my first java application using Eclipse. I've recently needed to adjust the
I was recently working on a project where I needed to convert a regular
I recently installed Oracle's VirtualBox on Ubuntu, due to the fact that I needed
I recently installed Microsoft Test Manager 2010 and this is my first experience with
whenever i needed to test my web site, i used to press ctrl and

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.