NSCFNumber 类自动释放,没有池 - 只是泄漏

发布于 2024-08-16 04:38:53 字数 742 浏览 8 评论 0原文

我是 C++ 新手,刚刚开始使用线程处理一个项目。

目前我的项目涉及OpenGL和OpenCV库,在编码过程中遇到以下错误:


当前语言:auto;目前是c++ 2009-12-21 14:54:49.438 3DTestApp[3210:7803] *** _NSAutoreleaseNoPool(): NSCFNumber 类的对象 0x10ebe0 自动释放,没有池 - 只是泄漏 堆栈:(0x91edff4f 0x91dec432 0x941ad394 0x94282218 0x94281b32 0x94528023 0x942813ef 0x94280dc6 0x94489ef4 0x944882ab 0x9350e13d 0x9350d5 7b 0x9350d3e0 0x93529e29 0x93529bce 0x935292a8 0x935290e4 0x5743e2) 杀 我设置了


断点,并意识到仅在执行以下行后才发生错误:

cvShowImage("Motion Tracker", detectorMotionScreen); (这段代码位于一个无限循环的线程中)

我用google搜索了一下,发现这个错误只发生在Objective C中,并且没有发现与C++相关的结果。

因此,我想问是否有人知道为什么会发生这种情况,并且有办法解决它吗?

编辑:我尝试添加框架 Foundation 来使用 NSAutoreleasePool,但是在编译时,它在我的代码中生成了很多关于语法的错误,而实际上没有错误。

I am new to C++ and have just started to work on a project using threading.

Currently my project involves the OpenGL and OpenCV libraries, and in the process of coding I encountered the following error :


Current language: auto; currently c++
2009-12-21 14:54:49.438 3DTestApp[3210:7803] *** _NSAutoreleaseNoPool(): Object 0x10ebe0 of class NSCFNumber autoreleased with no pool in place - just leaking
Stack: (0x91edff4f 0x91dec432 0x941ad394 0x94282218 0x94281b32 0x94528023 0x942813ef 0x94280dc6 0x94489ef4 0x944882ab 0x9350e13d 0x9350d57b 0x9350d3e0 0x93529e29 0x93529bce 0x935292a8 0x935290e4 0x5743e2)
kill
quit


I put breakpoints and realised the error occurred only after the following line was executed:

cvShowImage("Motion Tracker", detectionMotionScreen); (this code was in a thread with infinite loop)

I have googled around and realised that this error only occurred in Objective C, and I found no results related to C++.

As such, I would wish to ask if anyone has any idea why has this occurred, and is there anyway to fix it?

edit : I have tried adding the framework Foundation to use NSAutoreleasePool, however upon compiliing it generates alot of errors in my codes with regards to the syntax, when actually there were none.

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

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

发布评论

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

评论(1

烟花肆意 2024-08-23 04:38:53

Apple 在 IOKit 之外没有任何用 C++ 编写的公共接口,因此您不会找到任何公共接口。有关 CoreFoundation 内存管理的过程 C 文档位于此处。

如果您需要更具体的帮助,那么您需要更彻底地描述您正在做什么。

Apple doesn't have any public interfaces written in C++ outside of IOKit, so you're not going to find any. The procedural C documentation on CoreFoundation memory management is here.

If you want more specific help then you're going to need to describe what it is you're doing a lot more thoroughly.

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