使用仪器时出现内存泄漏问题

发布于 2024-10-16 13:19:03 字数 466 浏览 2 评论 0原文

我正在使用仪器检查内存泄漏,并在下面的代码中发现了泄漏

- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
self.highlighted = NO;
[[self gridView] selectRow:self.yPosition column:self.xPosition scrollPosition:MFGridViewScrollPositionNone animated:YES];
[self.delegate gridViewCellWasTouched:self];//**showing leak in this line**
[super touchesEnded:touches withEvent:event];

}

但是,我完全无法理解上述行中的泄漏是什么。仪器中还显示了许多类似的泄漏。谁能帮我解决这些问题...谢谢。

i was checking for memory leaks by using instruments and found a leak in the below code

- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
self.highlighted = NO;
[[self gridView] selectRow:self.yPosition column:self.xPosition scrollPosition:MFGridViewScrollPositionNone animated:YES];
[self.delegate gridViewCellWasTouched:self];//**showing leak in this line**
[super touchesEnded:touches withEvent:event];

}

But, i completely fail to understand what is the leak in the above mentioned line.. There were many more similar leaks which are being shown in instruments. Can anyone help me with these... Thank you.

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

新雨望断虹 2024-10-23 13:19:03

很难说这里的漏洞在哪里,因为没有人看到全貌。您必须跟踪堆栈跟踪,直到到达对系统库的某些调用。这将是您应该搜索泄漏的端点。这并不意味着泄漏确实存在。但那里肯定会有一个泄漏的物体。

It is really hard to say where is the leak here, because nobody sees the whole picture. You have to track down the stack trace until you reach some call to system library. This would be the endpoint from which you should search for the leak. It really doesn't mean that the leak is exactly there. But there would be a leaking object there for sure.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文