Note that there are some explanatory texts on larger screens.

plurals
  1. POMKAnnotationView memory leak issue
    primarykey
    data
    text
    <p>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 : </p> <p><img src="https://i.stack.imgur.com/ADcTr.png" alt="enter image description here"></p> <p>All of the memory locations from the NumberedAnnotationView group show the marked line as the problematic in viewForAnnotation </p> <pre><code>- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id &lt;MKAnnotation&gt;)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; } </code></pre> <p>The init looks like this : </p> <pre><code>-(id)initWithAnnotation:(id&lt;MKAnnotation&gt;)annotation reuseIdentifier:(NSString *)reuseIdentifier imageType:(int)imageType { self = [super initWithAnnotation: annotation reuseIdentifier: reuseIdentifier]; // THIS line if (self != nil) { // set stuff } return self; } </code></pre> <p>Even after minutes, these autoreleased objects are still there. ( 17 and 24 is the number of annotations displayed on map and removed with <code>[mapView removeAnnotations:[mapView annotations]];</code> each time I zoom in/out. </p> <p>The others, I think, are some MapKit generated stuff. I'm experiencing this in the simulator with versions 5.0 and 5.1. </p> <p>How could I fix this ? Is something that I'm missing ? Or is this the normal behavior of Mapkit ? </p> <p>Thanks! </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload