简体   繁体   English

使用线程来解决第三方iphone库中的内存泄漏问题

[英]Using threads to address memory leak in third party iphone libraries

I currently have implemented a third party library into my XCode project. 我目前在我的XCode项目中实现了第三方库。 The problem is that there are memory leaks which originate from the library which I found using Instruments. 问题是存在内存泄漏源自我使用Instruments发现的库。

My question is is it possible to kick off the API function which is leaking in a separate thread using the autorelease pool in order for that thread to clean up after itself? 我的问题是,是否有可能启动API函数,该函数在使用自动释放池的单独线程中泄漏,以便该线程自行清理? This way when I need to use it again, I start the function call in a different thread? 这种方式当我需要再次使用它时,我在另一个线程中启动函数调用? In essence my thought is that it would be garbage collecting the leaky code so that it doesn't impact the main executable. 从本质上讲,我的想法是垃圾收集漏洞代码,这样它就不会影响主要的可执行文件。

Memory leaks will be present either in the main thread or in any other thread. 内存泄漏将出现在主线程或任何其他线程中。 What's the difference between autoreleasing a leaking memory or releasing a leaking memory? 自动释放泄漏的内存或释放泄漏的内存有什么区别?

Same effect! 效果一样!

Fix the leaks. 修复泄漏。

Cheers 干杯

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM