Note that there are some explanatory texts on larger screens.

plurals
  1. POMKMapView leaks when removing Annotations or just me?
    primarykey
    data
    text
    <p>I'm getting leaks of my annotations. The code (stripped down to its bear minimum) in question is:</p> <pre><code>- (void)updateLocations:(NSArray *)result { [mapView removeAnnotations:locations]; [locations removeAllObjects]; [allLocations removeAllObjects]; for (NSDictionary *location in result) { LocationAnnotation *annote = [[LocationAnnotation alloc] initWithInfo:location]; [allLocations addObject:annote]; [annote release]; } [self updateAnnotations]; } - (void)filterLocations { for (LocationAnnotation *annote in allLocations) { if (annote.typeFlag &amp; filterFlags) { [locations addObject:annote]; } } } - (void)updateAnnotations { [self filterLocations]; [mapView addAnnotations:locations]; } - (void)updateFilter { [mapView removeAnnotations:locations]; [locations removeAllObjects]; [self updateAnnotations]; } </code></pre> <p><code>allLocations</code> is an array that contains all the annotations (they are not necessarily on the map), and <code>locations</code> is an array that holds the locations that are actually displayed in the map. When <code>updateLocations:</code> is called, some (or all, it changes from test to test) of the annotations added to the map are leaking. The allocation history of the annotations is:</p> <pre><code># Category Event Type Timestamp RefCt Address Size Responsible Library Responsible Caller 0 LocationAnnotation Malloc 16421111296 1 0x4953870 64 MyApp -[MapViewController updateLocations:] 1 LocationAnnotation Retain 16421383424 2 0x4953870 0 MyApp -[MapViewController updateLocations:] 2 LocationAnnotation Release 16421391104 1 0x4953870 0 MyApp -[MapViewController updateLocations:] 3 LocationAnnotation Retain 16444210176 2 0x4953870 0 MyApp -[MapViewController filterLocations] 4 LocationAnnotation Retain 16557738240 3 0x4953870 0 MapKit -[MKQuadTrie insert:] 5 LocationAnnotation Retain 16557750272 4 0x4953870 0 MapKit -[MKAnnotationContainerView addAnnotation:] 6 LocationAnnotation Retain 16564529408 5 0x4953870 0 MapKit -[MKQuadTrie insert:] 7 LocationAnnotation Release 17296397312 4 0x4953870 0 MapKit -[MKAnnotationContainerView showAddedAnnotationsAnimated:] 8 LocationAnnotation Retain 21832317184 5 0x4953870 0 MapKit -[MKAnnotationContainerView removeAnnotation:] 9 LocationAnnotation Autorelease 21832324096 0x4953870 0 MapKit -[MKAnnotationContainerView removeAnnotation:] 10 LocationAnnotation Release 21832350208 4 0x4953870 0 MapKit -[MKQuadTrie remove:] 11 LocationAnnotation Release 21920062208 3 0x4953870 0 MyApp -[MapViewController updateLocations:] 12 LocationAnnotation Release 21923836416 2 0x4953870 0 MyApp -[MapViewController updateLocations:] 13 LocationAnnotation Release 22050286336 1 0x4953870 0 Foundation -[NSAutoreleasePool drain] </code></pre> <p>And looking at this it seems the culprit is that <code>[MKQuadTrie insert:]</code> is called twice while only one <code>[MKQuadTrie remove:]</code> is called. Am I missing something and its my fault or is it a bug in MKMapKit?</p> <p>Edit: I have seen an allocation histroy with 14 [MKQuadTrie insert:] calls and only 1 [MKQuadTrie remove:]</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