记录额外生命物体的仪器
在我的应用程序的初始化中,我从 Core Data 托管对象上下文中读取一些数据。由于某种原因,即使只调用了一次executeFetchRequest 代码行,我还是在仪器分配工具对象列表中看到了5 个活动条目。例如,如果我从 Instruments 中深入查看源代码,我会看到以下内容:
我设置了在此行上断点,并验证应用程序仅在此行停止一次。但是,这是我在 Instruments 中看到的结果:
如果我查看每个的堆栈跟踪在这 5 个对象中,它是完全相同的,都指向第 135 行,如第一个屏幕截图所示。 (如您所见,我尝试了几种不同的场景,所有这些都具有相同的结果。)
所以我这里有两个问题。
问题#1:为什么我看到 5 个活体?
问题#2:为什么物体会有生命?据我所知,所有内容都被正确释放,并包装在应该处理这些对象的自动释放池中。
我使用的是 Xcode 4.2 和 iOS SDK 5.0。任何想法将不胜感激。谢谢。
In the initialization of my app, I am reading some data out of a Core Data managed object context. For some reason, even though the executeFetchRequest line of code is called only once, I am seeing 5 living entries in the Instruments Allocations tool object listing. For example, if I drill down into the source code from within Instruments, I see this:
I set a breakpoint on this line, and verified that the app is stopping on this line only once. However, this is what I see as a result in Instruments:
If I look at the stack trace for each of these 5 objects, it is exactly the same, all pointing back to line 135 as shown in the first screen shot. (As you can see, I have tried a few different scenarios and all of them have the same result.)
So I have two questions here.
Question #1: Why do I see 5 living objects?
Question #2: Why are the objects living any way? From what I can tell, everything is being released correctly, and wrapped inside autorelease pools that should take care of these objects.
I am on Xcode 4.2 with the iOS SDK 5.0. Any ideas would be appreciated. Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
CFData 实例只是数据块。也许它们代表数据库中的记录,但不知道 CoreData 的内部结构,这只是猜测。它们可以表示由 ManagedObjectContext 保存的缓存数据,但这也仅仅是猜测。
如果您没有看到任何泄漏报告,我不会太担心。
不过,如果有人对此有更深入的了解,请插话。
The CFData instances are just chunks of data. Perhaps they represent records in the database, but not knowing the internals of CoreData, that's just speculation. They could represent cached data held by the managedObjectContext, but that too is mere speculation.
If you're not seeing any leaks reported, I would not worry too much about it.
Although if anyone has more insight into this, please chime in.