代码之家  ›  专栏  ›  技术社区  ›  Primoz Rome

用iPhone应用程序中的仪器追踪内存泄漏

  •  4
  • Primoz Rome  · 技术社区  · 15 年前

    我正在创建一个视图控制器来控制从NIB文件加载的视图。该视图具有“显示用户位置”为真的地图视图。找到用户位置后,我使用MKReverseGeocoder获取位置数据。当我加载这个视图控制器并且MapKit找到用户位置时,漏洞总是存在的。我发现MKReverseGeocoder在这里不是问题,因为无论是否使用MKReverseGeocoder,我都会得到相同的泄漏。

    当我加载这个视图时,Instruments“leaks”报告内存泄漏。请参见图片上的屏幕截图: alt text

    以下是初始化控制器的方法:

    AddPlaceViewController *addPlaceVC = [[AddPlaceViewController alloc] initWithNibName:@"AddPlaceViewController" bundle:[NSBundle mainBundle]];
    addPlaceVC.delegate = self;
    UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:addPlaceVC];
    self.placeController = navigationController;
    [self presentModalViewController:self.placeController animated:YES];
    [addPlaceVC release];
    [navigationController release];
    

    1 回复  |  直到 9 年前
        1
  •  1
  •   Ole Begemann    15 年前

    既然负责任的库是“基础”,而不是你的代码,你对此无能为力(除了向苹果报告)。