mitchkramez
mitchkramez

Reputation: 21

iOS 6.1.3 EXC_BAD_ACCESS KERN_INVALID_ADDRESS

I have an app that is periodically crashing for the client. I'm unable to duplicate the crash, but I was able to get an error log from the client and I'm hoping someone could point me in the right direction as to what I should be looking at. This is in the minority of the crash reports, most of the other crash reports are Low Memory Events. The App uses ARC if it matters.

I'm new to this, so I just need to be pointed in the right direction, preferably kindly :)

Incident Identifier: C21570BF-3E76-44DD-BEB1-03FDA4A12750
CrashReporter Key:   ebcd6d296e2badb36644f9abfdae158007ba680e
Hardware Model:      iPad2,1
Process:         APP_NAME [106]
Path:            /var/mobile/Applications/F083D896-D881-4F8F-81FE-44BDA9C072EA/APP_NAME.app/APP_NAME
Identifier:      APP_NAME
Version:         ??? (???)
Code Type:       ARM (Native)
Parent Process:  launchd [1]

Date/Time:       2013-05-17 14:26:42.639 -0700
OS Version:      iOS 6.1.3 (10B329)
Report Version:  104

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0xc1ed2375
Crashed Thread:  0

Thread 0 name:  Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0   libobjc.A.dylib                 0x3b46b5b0 objc_msgSend + 16
1   UIKit                           0x35566080 -[UIAlertView(Private) _performPopup:animationType:revealedBySpringBoardAlert:] + 504
2   UIKit                           0x35582f28 -[UIAlertView(Private) _repopup] + 76
3   UIKit                           0x3556cbd4 -[UIAlertView(Private) _removeAlertWindowOrShowAnOldAlert] + 192
4   UIKit                           0x3556c996 -[UIAlertView(Private) _popoutAnimationDidStop:finished:] + 590
5   UIKit                           0x35429aae -[UIViewAnimationState sendDelegateAnimationDidStop:finished:] + 154
6   UIKit                           0x3549e8ea -[UIViewAnimationState animationDidStop:finished:] + 46
7   QuartzCore                      0x351d3bfc CA::Layer::run_animation_callbacks(void*) + 204
8   libdispatch.dylib               0x3b8874b4 _dispatch_client_callout + 20
9   libdispatch.dylib               0x3b88c1b8 _dispatch_main_queue_callback_4CF$VARIANT$mp + 220
10  CoreFoundation                  0x335dff36 __CFRunLoopRun + 1286
11  CoreFoundation                  0x33552eb8 CFRunLoopRunSpecific + 352
12  CoreFoundation                  0x33552d44 CFRunLoopRunInMode + 100
13  GraphicsServices                0x371092e6 GSEventRunModal + 70
14  UIKit                           0x354682fc UIApplicationMain + 1116
15  APP_NAME                            0x000bd492 main (main.m:16)
16  libdyld.dylib                   0x3b8a7b1c start + 0

Upvotes: 1

Views: 1892

Answers (1)

mitchkramez
mitchkramez

Reputation: 21

I realize now that this question wasn't framed very well.

I was using AFNetworking to upload files to the server. I was using:

NSData *videoData = [NSData dataWithContentsOfURL:[NSURL URLWithString:video.filename]];
NSMutableURLRequest *request = [[AppApiManager sharedManager] multipartFormRequestWithMethod:@"POST" path:@"videos/upload" parameters:parameters constructingBodyWithBlock:^(id<AFMultipartFormData>formData) {
[formData appendPartWithFileData:videoData name:@"video_filename" fileName:@"ipad-video.mov" mimeType:@"video/quicktime"];
}];

So basically, i was allocating memory to however big that video file was. The solution was to use a different method of attaching the file to the form request that streams it from the disk:

-appendPartWithFileURL:name:fileName:mimeType:error: will stream data directly from the file, making memory allocation beforehand unnecessary.

Long story short, I completely overlooked all the memory being allocated the NSData

Upvotes: 1

Related Questions