Tag: 内存泄漏

存储在“string”中的对象的潜在泄漏

我试图运行代码,但它使用静态分析器报告内存泄漏。 在这条线上作为一个对象的潜在泄漏存储到“string” return (__bridge NSString *)string; 这里是整个方法: +(NSString *)GUID { CFUUIDRef theUUID = CFUUIDCreate(NULL); CFStringRef string = CFUUIDCreateString(NULL, theUUID); CFRelease(theUUID); return (__bridge NSString *)string; } 让我知道如果别人需要更多的信息。

在启用ARC的C代码中执行Objective-C代码时,运行时内存泄漏警告

ARC被启用, bufferReady被一个C ++库(非ARC启用)触发,我确定我在某处丢失了一个ARC。 请指教。 提前致谢。 用下面的代码: @implementation HelloWorldLayer id refToSelf; //reference to self int shakeCounter = 0; void bufferReady() { if (shakeCounter % 100 == 0) { [refToSelf shakes]; } shakeCounter++; } – (void) shakes { CCRotateBy * rotate = [CCRotateBy actionWithDuration:0.1 angle:2]; CCActionInterval * rotateReverse = [rotate reverse]; CCSequence * seq1 = [CCSequence actions:rotate, […]

NSURLSession内存泄漏

即使使NSURLSession失效,使用Instruments运行configuration文件,一些名为TubeManager的类(可能是私有的),HTTPConnectionCache和HTTPConnectionCacheDictionary在内存中仍然存在。 代码片段重现: NSURLSessionConfiguration* config = [NSURLSessionConfiguration defaultSessionConfiguration]; NSURLSession* session = [NSURLSession sessionWithConfiguration:config]; NSURLRequest* request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.google.com"]]; NSURLSessionDataTask* sessionDataTask = [session dataTaskWithRequest:request completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) { [session finishTasksAndInvalidate]; }]; [sessionDataTask resume];

内存泄漏在CMSampleBufferGetImageBuffer

我得到一个CMSampleBufferRefvideo缓冲区每N个video帧的UIImage ,如: – (void)imageFromVideoBuffer:(void(^)(UIImage* image))completion { CMSampleBufferRef sampleBuffer = _myLastSampleBuffer; if (sampleBuffer != nil) { CFRetain(sampleBuffer); CIImage *ciImage = [CIImage imageWithCVPixelBuffer:CMSampleBufferGetImageBuffer(sampleBuffer)]; _lastAppendedVideoBuffer.sampleBuffer = nil; if (_context == nil) { _context = [CIContext contextWithOptions:nil]; } CVPixelBufferRef buffer = CMSampleBufferGetImageBuffer(sampleBuffer); CGImageRef cgImage = [_context createCGImage:ciImage fromRect: CGRectMake(0, 0, CVPixelBufferGetWidth(buffer), CVPixelBufferGetHeight(buffer))]; __block UIImage *image = [UIImage imageWithCGImage:cgImage]; CGImageRelease(cgImage); […]

IOS 8.3中的UIDatePicker内存泄漏

在运行IOS 8.3的iPad上的popup窗口中使用UIDatePicker时,会看到内存泄漏。 每次当dateselect器popup,然后解散时,我会在多次内存泄漏中获得大约5K的内存。 泄露的对象是NSDateComponents,并且负责的框架是[_UIDatePickerMode _yearlessYearForMonth:]。 我已经写了一个简单的testing应用程序来演示这个问题( https://github.com/david-ape/datepickertest/ )。 我已经包含一个UIPopoverController选项和一个UIPopoverPresentationController选项,但似乎并不重要。 我做错了什么,还是有解决方法,或者我需要等待苹果的修复? 如果是后者,那么是否有人可以build议我可以使用第三方控件来代替UIDatePicker? 以下是我用来popupdate选取器的代码。 头文件 #import <UIKit/UIKit.h> @interface ViewController : UIViewController <UIPopoverControllerDelegate, UIPopoverPresentationControllerDelegate> @end 实施文件 #import "ViewController.h" @interface ViewController () @property (nonatomic, strong) UIPopoverController *ios7Popover; – (IBAction)datePickerPopupIOS7:(UIButton *)sender; – (IBAction)datePickerPopupIOS8:(UIButton *)sender; @end @implementation ViewController // helper – returns a view controller containing a date picker for use […]

在xCode仪器泄漏周期图上显示“no ivar”

我正在使用仪器检查我的应用程序泄漏,我正在学习如何读取泄漏周期数据。 我在我的一个漏洞里得到这个图表: 图表的含义是什么? 什么意思是“没有伊娃”? 谢谢 沙尼

使用捕获列表中的无主,导致崩溃,甚至块本身不执行

在这里,我在玩漏洞,所以我有意识地做了一个强大的参考周期,看看仪器是否会检测到某些东西,并且我得到了意想不到的结果。 在乐器中显示的泄漏当然是有道理的,但随机的崩溃有点神秘(由于我将在后面提到的两个事实)。 我在这里有一个叫做SomeClass的类: class SomeClass{ //As you can guess, I will use this shady property to make a strong cycle 🙂 var closure:(()->())? init(){} func method(){} deinit {print("SomeClass deinited")} } 另外我有两个场景, GameScene : class GameScene: SKScene { override func didMoveToView(view: SKView) { backgroundColor = .blackColor() let someInstance = SomeClass() let closure = {[unowned self] in […]

ADMOB内存泄漏?

每当有新的广告出现时,我正在使用Swift语言来处理ADMOB,我的内存正在增加。 我觉得有一个泄漏。 没有ADMOB一切都很好。 var inter: GADInterstitial override func viewWillAppear(animated: Bool) { inter = GADInterstitial() inter.delegate = self inter.adUnitID = "****" var request:GADRequest = GADRequest() request.testDevices = [ "***" ] inter.loadRequest(request) } 我正在使用UIActionAlert来显示插页式广告 self.inter.presentFromRootViewController(self) 记忆报告链接: 难道我做错了什么? 我正在使用ARC。 我可以强制Interstitials发布此Interstitials EDİT : 我也试过GADBanner 。 我只是打开应用程序; 我没有做任何事情,记忆力正在增加 override func viewWillAppear(animated: Bool) { banner = GADBannerView() banner.delegate = self banner.adSize […]

MPMoviePlayerController仍然泄漏

我释放了MPMoviePlayerController,但内存分配和活动对象仍然高于对象分配之前。 但是,如果我重新分配对象,它不会泄漏更多。 我的应用程序实际上使用了很多媒体文件,内存消耗也很高。 我想完全释放不需要的内存以避免内存警告。 电影播放器​​版本: player.initialPlaybackTime = -1; [player.view removeFromSuperview]; [player stop]; [player release]; 电影播放器​​分配: NSURL *url = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"video0_hd.mov" ofType:nil]]; player = [[MPMoviePlayerController alloc] initWithContentURL:url]; player.view.frame = placeholder.frame; [self.view addSubview:player.view]; [player play];

iOS应用程序因内存不足而死亡,但未收到内存警告

一段时间以来,我遇到了一个问题,我想知道是否有人可以帮忙。 我正在开发一个IOS应用程序(iPad),使用主导航控制器和大量的UIImage。 在使用应用程序一段时间后,应用程序因为内存不足而死亡(不是特定的视图),但通过检查iPad日志,我并不总是看到低内存警告(有时候我会,有时候我不会)。 即使我收到一个,它只是“ 收到低内存警告 ”,但我从来没有得到“ 1级 ”或“ 2级 ”。 通过使用xCode的泄漏仪器,我找不到任何泄漏。 谁能帮忙?