Application crashes after when array of images are stored

0

I'm getting the screenshots from the following code:

CGImageRef cgScreen = UIGetScreenImage();
    if (cgScreen) {
        UIImage *result = [UIImage imageWithCGImage:cgScreen];
        CGImageRelease(cgScreen);
        return result;
    }

I'm calling the above code in a timer of 1/1.0 seconds as:

[array addObject:[UIImage imageWithScreenContents]];

where imagewithScreenContents is a function. But after some seconds i.e after adding 90 frames application crashes. I'm unable to understand the problem. Can somebody help me in solving the problem.

The following is the crash log report:- Incident Identifier: C2EE3C76-1467-4578-BCFE-A29C1F0008A6 CrashReporter Key: 66bc0900aa035a62f27c2c26fe3f6f3f1b8e7301 Process: VideoRecorderProject [98] Path: /var/mobile/Applications/37935917-FB62-48D4-9DF8-AC5D897C137F/VideoRecorderProject.app/VideoRecorderProject Identifier: VideoRecorderProject Version: ??? (???) Code Type: ARM (Native) Parent Process: debugserver [97]

Date/Time: 2007-01-08 19:13:52.228 +0530 OS Version: iPhone OS 3.1.2 (7D11) Report Version: 104

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

Thread 0 Crashed: 0 libobjc.A.dylib 0x32668ecc 0x32665000 + 16076 1 CoreFoundation 0x32d83d6a 0x32d4d000 + 224618 2 CoreFoundation 0x32d4fc28 0x32d4d000 + 11304 3 CoreFoundation 0x32d83c44 0x32d4d000 + 224324 4 CoreFoundation 0x32d9cc4c 0x32d4d000 + 326732 5 CoreFoundation 0x32da81d8 0x32d4d000 + 373208 6 CoreFoundation 0x32db05fc 0x32d4d000 + 407036 7 VideoRecorderProject 0x000031ca 0x1000 + 8650 8 Foundation 0x33f36d94 0x33f29000 + 56724 9 CoreFoundation 0x32da44bc 0x32d4d000 + 357564 10 CoreFoundation 0x32da3c18 0x32d4d000 + 355352 11 GraphicsServices 0x31bb936c 0x31bb5000 + 17260 12 UIKit 0x30bf3c28 0x30bf0000 + 15400 13 UIKit 0x30bf2228 0x30bf0000 + 8744 14 VideoRecorderProject 0x00003010 0x1000 + 8208 15 VideoRecorderProject 0x00002fac 0x1000 + 8108

Thread 1: 0 libSystem.B.dylib 0x3272e4b8 0x3272d000 + 5304 1 libSystem.B.dylib 0x32731094 0x3272d000 + 16532 2 CoreFoundation 0x32da4002 0x32d4d000 + 356354 3 CoreFoundation 0x32da3c18 0x32d4d000 + 355352 4 WebCore 0x32f486f0 0x32ec4000 + 542448 5 libSystem.B.dylib 0x327587b0 0x3272d000 + 178096

Thread 2: 0 libSystem.B.dylib 0x327be720 0x3272d000 + 595744 1 libSystem.B.dylib 0x327604d8 0x3272d000 + 210136 2 libSystem.B.dylib 0x3275fc9c 0x3272d000 + 208028 3 CoreMedia 0x31f78660 0x31f73000 + 22112 4 CoreMedia 0x31f7853c 0x31f73000 + 21820 5 MediaToolbox 0x319e5bb4 0x319e2000 + 15284 6 libSystem.B.dylib 0x327587b0 0x3272d000 + 178096

Thread 0 crashed with ARM Thread State: r0: 0x00a44610 r1: 0x3196dff0 r2: 0x01007a00 r3: 0x31972ec8 r4: 0x38602bf8 r5: 0x0460226c r6: 0x656a626f r7: 0x2fffe93c r8: 0x3841eff4 r9: 0x0100028a r10: 0x000000c8 r11: 0x3841eff4 ip: 0x38414230 sp: 0x2fffe924 lr: 0x32d83d71 pc: 0x32668ecc cpsr: 0x00000010

Binary Images: 0x1000 - 0x4a3fff +VideoRecorderProject armv6 /var/mobile/Applications/37935917-FB62-48D4-9DF8-AC5D897C137F/VideoRecorderProject.app/VideoRecorderProject 0x9a3000 - 0x9a4fff +MobileSubstrate.dylib armv6 /Library/MobileSubstrate/MobileSubstrate.dylib 0x9c0000 - 0x9c1fff dns.so armv6 <957f94410f77a351749ac39d2b4b4abe> /usr/lib/info/dns.so 0x9dc000 - 0x9e7fff +WinterBoard.dylib arm /Library/MobileSubstrate/DynamicLibraries/WinterBoard.dylib 0x9ee000 - 0x9f2fff libsubstrate.dylib armv6 /usr/lib/libsubstrate.dylib 0x2fe00000 - 0x2fe26fff dyld armv6 /usr/lib/dyld 0x301a0000 - 0x301a6fff MBX2D armv6 /System/Library/PrivateFrameworks/MBX2D.framework/MBX2D 0x301c4000 - 0x3037efff CoreGraphics armv6 <724ca87c683dfc06a7b8de93ad7529ab> /System/Library/Frameworks/CoreGraphics.framework/CoreGraphics 0x303ce000 - 0x3047bfff WebKit armv6 <0c25498f719543dfe237b3d5ad2b41f4> /System/Library/PrivateFrameworks/WebKit.framework/WebKit 0x30566000 - 0x30585fff Bom armv6 <53d3b28e15e1aef824becf93c177c7c7> /System/Library/PrivateFrameworks/Bom.framework/Bom 0x3058b000 - 0x305bffff Security armv6 <9b4c89ffb90e39d912571072fc4571db> /System/Library/Frameworks/Security.framework/Security 0x305c2000 - 0x305c3fff IOMobileFramebuffer armv6 <410c46b0db15595f49443de4b0f96bc1> /System/Library/PrivateFrameworks/IOMobileFramebuffer.framework/IOMobileFramebuffer 0x30a03000 - 0x30a0dfff libkxld.dylib armv6 /usr/lib/system/libkxld.dylib 0x30a53000 - 0x30a54fff CoreSurface armv6 /System/Library/PrivateFrameworks/CoreSurface.framework/CoreSurface 0x30a55000 - 0x30a93fff VideoToolbox armv6 <457298c79adc8623fa6ad998f871cd5f> /System/Library/PrivateFrameworks/VideoToolbox.framework/VideoToolbox 0x30ab3000 - 0x30ae7fff SystemConfiguration armv6 /System/Library/Frameworks/SystemConfiguration.framework/SystemConfiguration 0x30afe000 - 0x30b0cfff libz.1.dylib armv6 /usr/lib/libz.1.dylib 0x30bf0000 - 0x319e1fff UIKit armv6 <02702efa29385ec77b4fad6771ea9fea> /System/Library/Frameworks/UIKit.framework/UIKit 0x319e2000 - 0x31af8fff MediaToolbox armv6 <0a04b31799af43bec335c461e1ba1f8d> /System/Library/PrivateFrameworks/MediaToolbox.framework/MediaToolbox 0x31bad000 - 0x31bb4fff ProtocolBuffer armv6 <314f79317c7b3f8ccb5715f50a1c32bd> /System/Library/PrivateFrameworks/ProtocolBuffer.framework/ProtocolBuffer 0x31bb5000 - 0x31bc0fff GraphicsServices armv6 /System/Library/PrivateFrameworks/GraphicsServices.framework/GraphicsServices 0x31bc6000 - 0x31bd2fff DataAccessExpress armv6 /System/Library/PrivateFrameworks/DataAccessExpress.framework/DataAccessExpress 0x31bd3000 - 0x31cc9fff libxml2.2.dylib armv6 <0c9d767c5ea2052102d5364b731774a4> /usr/lib/libxml2.2.dylib 0x31d27000 - 0x31d33fff IAP armv6 /System/Library/PrivateFrameworks/IAP.framework/IAP 0x31d34000 - 0x31d3cfff AccountSettings armv6 <439ef235750de9dd46831e87cc1d47a4> /System/Library/PrivateFrameworks/AccountSettings.framework/AccountSettings 0x31d68000 - 0x31e69fff libicucore.A.dylib armv6 <48d461b0b7e4c3c34fdd8906e43a9c48> /usr/lib/libicucore.A.dylib 0x31f05000 - 0x31f72fff CFNetwork armv6 <0c45ba25308645c6e0e6a0934c8ecc98> /System/Library/Frameworks/CFNetwork.framework/CFNetwork 0x31f73000 - 0x31fbafff CoreMedia armv6 <459a316db9a67b3f336d081196b17001> /System/Library/PrivateFrameworks/CoreMedia.framework/CoreMedia 0x31fbb000 - 0x3210ffff AudioToolbox armv6 <449419ad6f59bbfef367d329152d8466> /System/Library/Frameworks/AudioToolbox.framework/AudioToolbox 0x32112000 - 0x32114fff CrashReporterSupport armv6 <12376568046badc4c6993e85624671c4> /System/Library/PrivateFrameworks/CrashReporterSupport.framework/CrashReporterSupport 0x321cd000 - 0x32228fff CoreAudio armv6 /System/Library/Frameworks/CoreAudio.framework/CoreAudio 0x32285000 - 0x322dffff libsqlite3.dylib armv6 /usr/lib/libsqlite3.dylib 0x322f4000 - 0x322f6fff AppleJPEG armv6 /System/Library/PrivateFrameworks/AppleJPEG.framework/AppleJPEG 0x324ab000 - 0x324e5fff libvDSP.dylib armv6 /System/Library/PrivateFrameworks/Accelerate.framework/Frameworks/vecLib.framework/libvDSP.dylib 0x32665000 - 0x32708fff libobjc.A.dylib armv6 <70da12c30a834268531d6fc845833f9b> /usr/lib/libobjc.A.dylib 0x3272d000 - 0x32853fff libSystem.B.dylib armv6 /usr/lib/libSystem.B.dylib 0x32990000 - 0x329aefff libresolv.9.dylib armv6 /usr/lib/libresolv.9.dylib 0x329ec000 - 0x32a4dfff GMM armv6 <0353946f7ed83f41e2fca11040f47a36> /System/Library/PrivateFrameworks/GMM.framework/GMM 0x32a7d000 - 0x32af9fff AddressBookUI armv6 /System/Library/Frameworks/AddressBookUI.framework/AddressBookUI 0x32afa000 - 0x32b1dfff libRIP.A.dylib armv6 /System/Library/Frameworks/CoreGraphics.framework/Resources/libRIP.A.dylib 0x32b3e000 - 0x32b8bfff IOKit armv6 <0c1722088423026dbc67adb8a83c4b8b> /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit 0x32c95000 - 0x32c98fff MobileInstallation armv6 /System/Library/PrivateFrameworks/MobileInstallation.framework/MobileInstallation 0x32d4d000 - 0x32df9fff CoreFoundation armv6 /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation 0x32e15000 - 0x32e25fff libbsm.0.dylib armv6 <050c16b1a6ea7e4e3c80556a2f9c746e> /usr/lib/libbsm.0.dylib 0x32e2f000 - 0x32e56fff AppSupport armv6 <5c2d41e8c22380b938e7a3194adff14e> /System/Library/PrivateFrameworks/AppSupport.framework/AppSupport 0x32e85000 - 0x32e91fff CoreVideo armv6 <5ff949c6e178ed567a3516fec7a336fb> /System/Library/PrivateFrameworks/CoreVideo.framework/CoreVideo 0x32ec4000 - 0x33617fff WebCore armv6 <7621be5a489bafd9129ec542ee5faf6a> /System/Library/PrivateFrameworks/WebCore.framework/WebCore 0x33624000 - 0x3370bfff MusicLibrary armv6 <3619add890481e699291fc9eeb08ff16> /System/Library/PrivateFrameworks/MusicLibrary.framework/MusicLibrary 0x3370c000 - 0x33781fff MediaPlayer armv6 /System/Library/Frameworks/MediaPlayer.framework/MediaPlayer 0x337b4000 - 0x33837fff PhotoLibrary armv6 /System/Library/PrivateFrameworks/PhotoLibrary.framework/PhotoLibrary 0x33838000 - 0x3384afff TelephonyUI armv6 <4c4bd6cd6e4137c7f0ec4959b3966144> /System/Library/PrivateFrameworks/TelephonyUI.framework/TelephonyUI 0x3384b000 - 0x33855fff MobileCoreServices armv6 <976de01a455ee09d192898dc306043e2> /System/Library/Frameworks/MobileCoreServices.framework/MobileCoreServices 0x33856000 - 0x3385ffff SpringBoardServices armv6 /System/Library/PrivateFrameworks/SpringBoardServices.framework/SpringBoardServices 0x33860000 - 0x338cafff libstdc++.6.dylib armv6 <3fa3413ae26f5e206c8a2ee46fb04bfb> /usr/lib/libstdc++.6.dylib 0x338cb000 - 0x338d2fff MobileMusicPlayer armv6 <34f1d2d3c143e37bcb35d15eee9690f6> /System/Library/PrivateFrameworks/MobileMusicPlayer.framework/MobileMusicPlayer 0x338f3000 - 0x3391ffff CoreLocation armv6 <42ac528bf061b83d5f9247f59be52ab2> /System/Library/Frameworks/CoreLocation.framework/CoreLocation 0x33924000 - 0x3395efff CoreTelephony armv6 /System/Library/PrivateFrameworks/CoreTelephony.framework/CoreTelephony 0x3395f000 - 0x33963fff IOSurface armv6 <5eb19b9643e17c51321283ba4a598d22> /System/Library/PrivateFrameworks/IOSurface.framework/IOSurface 0x33bd6000 - 0x33bdbfff ITSync armv6 <69bcae4bd9e96753e063524a636273ce> /System/Library/PrivateFrameworks/ITSync.framework/ITSync 0x33be6000 - 0x33ce3fff JavaScriptCore armv6 /System/Library/PrivateFrameworks/JavaScriptCore.framework/JavaScriptCore 0x33ce4000 - 0x33ceffff libbz2.1.0.dylib armv6 <428a3247762594db6424083116f0aa6a> /usr/lib/libbz2.1.0.dylib 0x33cf0000 - 0x33cf0fff vecLib armv6 /System/Library/PrivateFrameworks/Accelerate.framework/Frameworks/vecLib.framework/vecLib 0x33d02000 - 0x33d02fff Accelerate armv6 <21e1dc9fad96f0d51afbeb7f7e006aaf> /System/Library/PrivateFrameworks/Accelerate.framework/Accelerate 0x33d03000 - 0x33d12fff MobileBluetooth armv6 /System/Library/PrivateFrameworks/MobileBluetooth.framework/MobileBluetooth 0x33e57000 - 0x33e75fff AddressBook armv6 <314d6d5c19d8a41144176a9772aeeb8e> /System/Library/Frameworks/AddressBook.framework/AddressBook 0x33e7b000 - 0x33f25fff QuartzCore armv6 /System/Library/Frameworks/QuartzCore.framework/QuartzCore 0x33f29000 - 0x34021fff Foundation armv6 <666e9e488f83b9e196aa70a6b44fdc93> /System/Library/Frameworks/Foundation.framework/Foundation 0x34041000 - 0x34058fff OpenGLES armv6 <0c5c914ead991e607b89d480e4215fe8> /System/Library/Frameworks/OpenGLES.framework/OpenGLES 0x34059000 - 0x34106fff ImageIO armv6 /System/Library/PrivateFrameworks/ImageIO.framework/ImageIO 0x34112000 - 0x3414ffff libCGFreetype.A.dylib armv6 <50e793fc4b4de6b598be29d591a31f0d> /System/Library/Frameworks/CoreGraphics.framework/Resources/libCGFreetype.A.dylib 0x34150000 - 0x34152fff ArtworkCache armv6 <6ed4c29dcdbff2213ce8fa156bd65215> /System/Library/PrivateFrameworks/ArtworkCache.framework/ArtworkCache 0x34285000 - 0x342d5fff Celestial armv6 /System/Library/PrivateFrameworks/Celestial.framework/Celestial 0x342f9000 - 0x34337fff CoreText armv6 /System/Library/PrivateFrameworks/CoreText.framework/CoreText 0x34358000 - 0x3435efff liblockdown.dylib armv6 <6fe2483fe67d4fc5c932ae02a64501c2> /usr/lib/liblockdown.dylib 0x3435f000 - 0x34367fff libgcc_s.1.dylib armv6 <6673f222acee5f3a208169712387862a> /usr/lib/libgcc_s.1.dylib 0x343ab000 - 0x343adfff Camera armv6 <83d973c375886b5c4632beae0cea27c6> /System/Library/PrivateFrameworks/Camera.framework/Camera

Thanks in Adv.

iphone
objective-c
nsmutablearray
asked on Stack Overflow Apr 8, 2010 by sujyanarayan • edited Apr 8, 2010 by sujyanarayan

1 Answer

0

You must not release the image obtained by UIGetScreenImage();. See here for a detailed explanation. This is most likely the reason for the EXC_BAD_ACCESS.

answered on Stack Overflow Apr 8, 2010 by Alfonso

User contributions licensed under CC BY-SA 3.0