EXC_BAD_ACCESS in GPUImageFramebuffer newCGImageFromFramebufferContents
I got an exception:
EXC_BAD_ACCESS (code=EXC_ARM_DA_ALIGN, address=0x5) in this method:
[GPUImageFramebuffer newCGImageFromFramebufferContents]
Sometimes this line:
CFRetain(renderTarget);
Sometimes this line:
NSUInteger paddedWidthOfImage = CVPixelBufferGetBytesPerRow(renderTarget) / 4.0;
This is how I use the framework to cause the exception:
GPUImageSmoothToonFilter *filter = [[GPUImageSmoothToonFilter alloc] init];
[filter setValuesForKeysWithDictionary:parameters];
CGImageRef filteredCGImage = [filter newCGImageByFilteringCGImage:aCGImageRef];
It doesn't happen every time. Maybe on average 5% of the time I get this exception. What can I do to avoid the exception or am I using it incorrectly? I can't really release it with the crash. I wrote a simple program with a slider to change the value to reproduce it. Let me know if you need more info.
Thanks so much for the help.
tsoang, please have a look at my latest comment here #1695.
Can you verify the bug is gone with that change?
This crash on bad memory access still occurs with similar steps outlined in tsoang's opening post. I'll second tsoang - this doesn't happen all the time, but frequent enough to take notice.
Using release 0.1.4 via cocoapods.
library usage is as follows - GPUImageGaussianBlurFilter *filter = [[GPUImageGaussianBlurFilter alloc] init]; filter.blurRadiusInPixels = radius; UIImage *blurredSnapshotImage = [filter imageByFilteringImage:snapshotImage];
results in - bad access at GPUImageFramebuffer.m:326 NSUInteger paddedWidthOfImage = CVPixelBufferGetBytesPerRow(renderTarget) / 4.0;
renderTarget has the value 0x4;
Issue is not fixed with 0.1.5.
reproduction conditions remain the same.
crash occurs at GPUImageFrameBuffer.m:333 - CFRetain(renderTarget); // I need to retain the pixel buffer here and release in the data source callback to prevent its bytes from being prematurely deallocated during a photo write operation
renderTarget is NULL
full stacktrace : #1 0x00384404 in __56-[GPUImageFramebuffer newCGImageFromFramebufferContents]_block_invoke at /Users/bmatsuo/repos/com.mobileiron.client.ios.polaris/Lyra/Pods/GPUImage/framework/Source/GPUImageFramebuffer.m:333 #2 0x3976fd3e in _dispatch_client_callout () #3 0x3977456e in _dispatch_barrier_sync_f_slow () #4 0x003a30b0 in runSynchronouslyOnVideoProcessingQueue at /Users/bmatsuo/repos/com.mobileiron.client.ios.polaris/Lyra/Pods/GPUImage/framework/Source/GPUImageOutput.m:30 #5 0x00384234 in -[GPUImageFramebuffer newCGImageFromFramebufferContents] at /Users/bmatsuo/repos/com.mobileiron.client.ios.polaris/Lyra/Pods/GPUImage/framework/Source/GPUImageFramebuffer.m:317 #6 0x0037b794 in -[GPUImageFilter newCGImageFromCurrentlyProcessedOutput] at /Users/bmatsuo/repos/com.mobileiron.client.ios.polaris/Lyra/Pods/GPUImage/framework/Source/GPUImageFilter.m:196 #7 0x003a45f0 in -[GPUImageOutput newCGImageByFilteringCGImage:] at /Users/bmatsuo/repos/com.mobileiron.client.ios.polaris/Lyra/Pods/GPUImage/framework/Source/GPUImageOutput.m:291 #8 0x003a47cc in -[GPUImageOutput imageByFilteringImage:] at /Users/bmatsuo/repos/com.mobileiron.client.ios.polaris/Lyra/Pods/GPUImage/framework/Source/GPUImageOutput.m:344 #9 0x0010255e in +[MILUIUtils blurredImageViewForViewController:afterScreenUpdates:withBlurRadius:] at /Users/bmatsuo/repos/com.mobileiron.client.ios.polaris/Lyra/Lyra/MILUIUtils.m:44
On Thu, Aug 28, 2014 at 11:55 AM, Norbert94 [email protected] wrote:
Is this issue resolved in the newest released?
— Reply to this email directly or view it on GitHub https://github.com/BradLarson/GPUImage/issues/1639#issuecomment-53777700 .
@nsixbdg : I am not sure if this is the same thing I encountered , But taking a strong reference of filter, Movie writer etc. should fix this crash. The objects get deallocated before the next frame is processed.
I'm seeing the same crashes, are there any workarounds?
@nsixbdg I have the same problem, did the answer from @shashank-shanks worked for you? Thanks
i found several crash logs from my app users showed the same exceptions here!!
You can try my way to resolve the issue #2390