iphone - MKMapView leaks when removing Annotations or just me? -


i'm getting leaks of annotations. code (stripped down bear minimum) in question is:

- (void)updatelocations:(nsarray *)result {     [mapview removeannotations:locations];     [locations removeallobjects];     [alllocations removeallobjects];     (nsdictionary *location in result) {         locationannotation *annote = [[locationannotation alloc] initwithinfo:location];         [alllocations addobject:annote];         [annote release];     }     [self updateannotations]; }  - (void)filterlocations {     (locationannotation *annote in alllocations) {         if (annote.typeflag & filterflags) {             [locations addobject:annote];         }     } }  - (void)updateannotations {     [self filterlocations];     [mapview addannotations:locations]; }  - (void)updatefilter {     [mapview removeannotations:locations];     [locations removeallobjects];     [self updateannotations]; } 

alllocations array contains annotations (they not on map), , locations array holds locations displayed in map. when updatelocations: called, (or all, changes test test) of annotations added map leaking. allocation history of annotations is:

#   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] 

and looking @ seems culprit [mkquadtrie insert:] called twice while 1 [mkquadtrie remove:] called. missing , fault or bug in mkmapkit?

edit: have seen allocation histroy 14 [mkquadtrie insert:] calls , 1 [mkquadtrie remove:]

ok solved problem me

i trying remove annotations , add new ones (but code making sure didn't remove user location). code

i replaced this

[self.map removeannotations: [self.map.annotations filteredarrayusingpredicate:[nspredicate predicatewithformat:@"!(self iskindofclass: %@)", [mkuserlocation class]]]]; 

and don't same issue.


Comments

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

windows - Python Service Installation - "Could not find PythonClass entry" -

Determine if a XmlNode is empty or null in C#? -