MKMapView 内存泄漏

发布于 2025-01-01 15:41:48 字数 520 浏览 4 评论 0原文

我在使用 MKMapView 时遇到内存泄漏问题。 MKMapView 本身被释放,但其他一些对象(如 MKTileView、MKMapTileViewImp 和 MKTiledLayer)不会被销毁,最终会重新创建和泄漏。

我用一段简单的代码重现了效果

@implementation ViewController
{
    MKMapView * mapView;
}


- (void)leak:(id)sender
{
    [mapView removeFromSuperview];
    mapView = [[MKMapView alloc] initWithFrame: CGRectMake(20, 20, 20, 20)];
    [self.view addSubview: mapView];
}

每次按下连接到泄漏的按钮时,MKTileView 的新实例就会泄漏。

我正在使用ARC。我查看了其他问题,但似乎没有人提到我在这里看到的相同泄漏。

有什么想法可能是我的问题吗?

I've got a problem with memory leaks in my use of MKMapView. The MKMapView itself is deallocated, but some other objects like MKTileView, MKMapTileViewImp, and MKTiledLayer don't get destroyed and end up recreated and leaking.

I've reproduced the effect in a simple piece of code

@implementation ViewController
{
    MKMapView * mapView;
}


- (void)leak:(id)sender
{
    [mapView removeFromSuperview];
    mapView = [[MKMapView alloc] initWithFrame: CGRectMake(20, 20, 20, 20)];
    [self.view addSubview: mapView];
}

Everytime the button hooked up to leak is pushed, a new instance of MKTileView gets leaked.

I'm using ARC. I've looked at the other questions, but none seem to mention the same leaks that I'm seeing here.

Any ideas what my problem might be?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文