1
NSUInteger numPoints = [[self locationFake] count];
CLLocationCoordinate2D *pointsPtr = malloc(numPoints * sizeof(CLLocationCoordinate2D));
for(int counter=0; counter<numPoints; counter++) {
pointsPtr[counter] = [[[self locationFake] objectAtIndex:counter] coordinate];
}
// (1)
MKPolyline *polyline = [MKPolyline polylineWithCoordinates:pointsPtr count:numPoints];
free(pointsPtr);
pointsPtr = NULL;
我已經創建了MKPolyline
對象(1)之後,我可以釋放這些點所使用的內存,或者做了MKPolyline
保持引用它的創作之後的內存和我不應該免費的點,直到我完全完成對MKPolyline
對象?
您好,我已經使用MKMapPoint * pointArr = malloc(sizeof ..),free(pointArr)。雖然我仍然面臨記憶問題。任何其他指導? – Paradise 2015-08-04 12:56:36