App crash in take a picture option in uiimagepicker

1

I have take the photo(uiimagepicker camera mode) from device and resize the image and set it to my image view. But my apps get crashed for some devices after hitting the "use" button in uiimagepicker camera.The application get crashed, when the many application runs in the background(low memory issue). Once i restart a device it will works.There is no leak in my coding.So how could i resolve this issue without restarting?

this is my crash log

Incident Identifier: 75C7596E-0A18-4EC1-A633-2EAE83FC75F1
CrashReporter Key:   4dd5a08c744fca1ac4cabbf890c3da0b4ae81b4f
Hardware Model:      iPhone3,1
Process:         myapp [2866]
Path:            /var/mobile/Applications/6B8D12F7-E875-436A-B4D8-FFA6CE169377/myapp.app/myapp
Identifier:      myapp
Version:         ??? (???)
Code Type:       ARM (Native)
Parent Process:  launchd [1]

Date/Time:       2011-08-18 19:07:35.963 -0500
OS Version:      iPhone OS 4.3 (8F190)
Report Version:  104

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

Thread 0 name:  Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0   libobjc.A.dylib                 0x366b1ca4 0x366af000 + 11428
1   UIKit                           0x3581d56e 0x35622000 + 2078062
2   PhotoLibrary                    0x31875c3e 0x31831000 + 281662
3   PhotoLibrary                    0x318866e0 0x31831000 + 349920
4   PhotoLibrary                    0x318a1018 0x31831000 + 458776
5   PhotoLibrary                    0x318bef46 0x31831000 + 581446
6   CoreFoundation                  0x323ddefc 0x323d2000 + 48892
7   Foundation                      0x320c77a2 0x32038000 + 587682
8   CoreFoundation                  0x32447a72 0x323d2000 + 481906
9   CoreFoundation                  0x32449758 0x323d2000 + 489304
10  CoreFoundation                  0x3244a4e4 0x323d2000 + 492772
11  CoreFoundation                  0x323daebc 0x323d2000 + 36540
12  CoreFoundation                  0x323dadc4 0x323d2000 + 36292
13  GraphicsServices                0x30682418 0x3067e000 + 17432
14  GraphicsServices                0x306824c4 0x3067e000 + 17604
15  UIKit                           0x35650d62 0x35622000 + 191842
16  UIKit                           0x3564e800 0x35622000 + 182272
17  myapp                   0x00002ed6 0x1000 + 7894
18  myapp                   0x00002ea0 0x1000 + 7840

Thread 1 name:  Dispatch queue: com.apple.libdispatch-manager
Thread 1:
0   libsystem_kernel.dylib          0x30d2efbc 0x30d1c000 + 77756
1   libdispatch.dylib               0x3202b094 0x32025000 + 24724
2   libdispatch.dylib               0x3202c04a 0x32025000 + 28746
3   libdispatch.dylib               0x3202b60a 0x32025000 + 26122
4   libsystem_c.dylib               0x3624b58a 0x36217000 + 214410
5   libsystem_c.dylib               0x3624bbbc 0x36217000 + 215996

Thread 2 name:  WebThread
Thread 2:
0   libsystem_kernel.dylib          0x30d2bc00 0x30d1c000 + 64512
1   libsystem_kernel.dylib          0x30d2b758 0x30d1c000 + 63320
2   CoreFoundation                  0x324482b8 0x323d2000 + 484024
3   CoreFoundation                  0x3244a562 0x323d2000 + 492898
4   CoreFoundation                  0x323daebc 0x323d2000 + 36540
5   CoreFoundation                  0x323dadc4 0x323d2000 + 36292
6   WebCore                         0x3113137a 0x3112b000 + 25466
7   libsystem_c.dylib               0x3624a30a 0x36217000 + 209674
8   libsystem_c.dylib               0x3624bbb4 0x36217000 + 215988

Thread 3:
0   libsystem_kernel.dylib          0x30d2bc00 0x30d1c000 + 64512
1   libsystem_kernel.dylib          0x30d2b758 0x30d1c000 + 63320
2   CoreFoundation                  0x324482b8 0x323d2000 + 484024
3   CoreFoundation                  0x3244a562 0x323d2000 + 492898
4   CoreFoundation                  0x323daebc 0x323d2000 + 36540
5   CoreFoundation                  0x323dadc4 0x323d2000 + 36292
6   Foundation                      0x320627f6 0x32038000 + 174070
7   Foundation                      0x32055382 0x32038000 + 119682
8   Foundation                      0x320c75c6 0x32038000 + 587206
9   libsystem_c.dylib               0x3624a30a 0x36217000 + 209674
10  libsystem_c.dylib               0x3624bbb4 0x36217000 + 215988

Thread 4 name:  com.apple.CFSocket.private
Thread 4:
0   libsystem_kernel.dylib          0x30d2dc60 0x30d1c000 + 72800
1   CoreFoundation                  0x3244d8f2 0x323d2000 + 506098
2   libsystem_c.dylib               0x3624a30a 0x36217000 + 209674
3   libsystem_c.dylib               0x3624bbb4 0x36217000 + 215988

Thread 5 name:  com.apple.coremedia.player.async
Thread 5:
0   libsystem_kernel.dylib          0x30d2dd18 0x30d1c000 + 72984
1   libsystem_c.dylib               0x36271860 0x36217000 + 370784
2   libsystem_c.dylib               0x36218eb2 0x36217000 + 7858
3   CoreMedia                       0x3677b8f4 0x36779000 + 10484
4   CoreMedia                       0x3677b83a 0x36779000 + 10298
5   MediaToolbox                    0x36a51a64 0x36a4e000 + 14948
6   CoreMedia                       0x367994dc 0x36779000 + 132316
7   libsystem_c.dylib               0x3624a30a 0x36217000 + 209674
8   libsystem_c.dylib               0x3624bbb4 0x36217000 + 215988

Thread 6:
0   libsystem_kernel.dylib          0x30d2dd18 0x30d1c000 + 72984
1   libsystem_c.dylib               0x36271860 0x36217000 + 370784
2   libsystem_c.dylib               0x36218eb2 0x36217000 + 7858
3   Foundation                      0x32062904 0x32038000 + 174340
4   Foundation                      0x32044816 0x32038000 + 51222
5   Foundation                      0x320c6b80 0x32038000 + 584576
6   PhotoLibrary                    0x318bf1f4 0x31831000 + 582132
7   Foundation                      0x32055382 0x32038000 + 119682
8   Foundation                      0x320c75c6 0x32038000 + 587206
9   libsystem_c.dylib               0x3624a30a 0x36217000 + 209674
10  libsystem_c.dylib               0x3624bbb4 0x36217000 + 215988

Thread 7 name:  Dispatch queue: com.apple.camera.avcapturesession
Thread 7:
0   libsystem_kernel.dylib          0x30d2bc00 0x30d1c000 + 64512
1   libsystem_kernel.dylib          0x30d2b758 0x30d1c000 + 63320
2   CoreFoundation                  0x324482b8 0x323d2000 + 484024
3   CoreFoundation                  0x3244a562 0x323d2000 + 492898
4   CoreFoundation                  0x323daebc 0x323d2000 + 36540
5   CoreFoundation                  0x323dadc4 0x323d2000 + 36292
6   AVFoundation                    0x317c2ac0 0x31766000 + 379584
7   AVFoundation                    0x317c277e 0x31766000 + 378750
8   AVFoundation                    0x317b4eb0 0x31766000 + 323248
9   AVFoundation                    0x317af7d2 0x31766000 + 301010
10  AVFoundation                    0x317b2c2e 0x31766000 + 314414
11  PhotoLibrary                    0x3186ab28 0x31831000 + 236328
12  PhotoLibrary                    0x318674b0 0x31831000 + 222384
13  libdispatch.dylib               0x320308e0 0x32025000 + 47328
14  libdispatch.dylib               0x3202beca 0x32025000 + 28362
15  libdispatch.dylib               0x3202c03c 0x32025000 + 28732
16  libdispatch.dylib               0x3202b60a 0x32025000 + 26122
17  libsystem_c.dylib               0x3624b58a 0x36217000 + 214410
18  libsystem_c.dylib               0x3624bbbc 0x36217000 + 215996

Thread 8:
0   libsystem_kernel.dylib          0x30d2e3ec 0x30d1c000 + 74732
1   libsystem_c.dylib               0x3624b6d8 0x36217000 + 214744
2   libsystem_c.dylib               0x3624bbbc 0x36217000 + 215996

Thread 0 crashed with ARM Thread State:
    r0: 0x00100c10    r1: 0x35928758      r2: 0x07491370      r3: 0x04000011
    r4: 0x00119560    r5: 0x08642140      r6: 0x78ff6169      r7: 0x2fdfe984
    r8: 0x000000b4    r9: 0x074fc0a0     r10: 0x0001fd88     r11: 0x35915368
    ip: 0x3f3f52e8    sp: 0x2fdfe958      lr: 0x0000ba99      pc: 0x366b1ca4
  cpsr: 0x200f0030

Binary Images:
    0x1000 -    0x1cfff +myapp armv7  <ba60578c55c59d6bdd038343546fd7b1> /var/mobile/Applications/6B8D12F7-E875-436A-B4D8-FFA6CE169377/myapp.app/myapp
   0x46000 -    0x46fff +MobileSubstrate.dylib armv6  <4070bd34b2c273416bcec248fd8b873d> /Library/MobileSubstrate/MobileSubstrate.dylib
   0x75000 -    0x76fff +SubstrateLoader.dylib armv6  <ff6a576a67626b81229111c8c4169d09> /Library/Frameworks/CydiaSubstrate.framework/Libraries/SubstrateLoader.dylib
   0x99000 -    0x9dfff +IntelliStatusIconsView.dylib arm  <006471029548d3d3959d1e9c2fe354ef> /Library/MobileSubstrate/DynamicLibraries/IntelliStatusIconsView.dylib
0x2fe00000 - 0x2fe25fff  dyld armv7  <8dbdf7bab30e355b81e7b2e333d5459b> /usr/lib/dyld
0x305c5000 - 0x305c9fff  AssetsLibraryServices armv7  <2e841b3daf303b38bbd82e0954659af4> /System/Library/PrivateFrameworks/AssetsLibraryServices.framework/AssetsLibraryServices
0x3067e000 - 0x3068afff  GraphicsServices armv7  <c37066a0784335d189f009ff4965717d> /System/Library/PrivateFrameworks/GraphicsServices.framework/GraphicsServices
0x3068b000 - 0x3068dfff  MobileInstallation armv7  <94b6d6c5d9883175af26764567528127> /System/Library/PrivateFrameworks/MobileInstallation.framework/MobileInstallation
0x3068e000 - 0x3069afff  HomeSharing armv7  <15261a39efdf314bacd636c5598350be> /System/Library/PrivateFrameworks/HomeSharing.framework/HomeSharing
0x30791000 - 0x3079efff  DataDetectorsUI armv7  <d454cde062983860a41694922eb5c042> /System/Library/PrivateFrameworks/DataDetectorsUI.framework/DataDetectorsUI
0x3079f000 - 0x3079ffff  libdnsinfo.dylib armv7  <21415179ffa03f949fa8cc851c6c31c7> /usr/lib/system/libdnsinfo.dylib
0x30888000 - 0x30890fff  MobileBluetooth armv7  <d0167be199b234f5bd233380111b2735> /System/Library/PrivateFrameworks/MobileBluetooth.framework/MobileBluetooth
0x30891000 - 0x308b0fff  Bom armv7  <b178e3efb4d733c694bd5a55e57a314f> /System/Library/PrivateFrameworks/Bom.framework/Bom
0x3098b000 - 0x30994fff  ITSync armv7  <dc57c003aad83864827ccf95fc579563> /System/Library/PrivateFrameworks/ITSync.framework/ITSync
0x30999000 - 0x309dbfff  CoreAudio armv7  <d45e275525ef3c32b36e0f1020cad705> /System/Library/Frameworks/CoreAudio.framework/CoreAudio
0x309dc000 - 0x309dffff  CaptiveNetwork armv7  <fc834fd33a18341ea7506587ad895703> /System/Library/PrivateFrameworks/CaptiveNetwork.framework/CaptiveNetwork
0x309fa000 - 0x30a04fff  AccountSettings armv7  <d083fb384dc7311eb6766b9b2d2dd9c8> /System/Library/PrivateFrameworks/AccountSettings.framework/AccountSettings
0x30a35000 - 0x30a68fff  StoreServices armv7  <a74659288dea34bca7a7911c19cf2c28> /System/Library/PrivateFrameworks/StoreServices.framework/StoreServices
0x30a69000 - 0x30a6afff  CoreSurface armv7  <7b83cd757da73e6e826693c29296d3fa> /System/Library/PrivateFrameworks/CoreSurface.framework/CoreSurface
0x30a6b000 - 0x30a6dfff  Camera armv7  <fd4d53b318ab35ce9bb89db3879120f0> /System/Library/PrivateFrameworks/Camera.framework/Camera
0x30ad5000 - 0x30b1efff  IMCore armv7  <9c1e280e1fa33fa784cad479b9cbd941> /System/Library/PrivateFrameworks/IMCore.framework/IMCore
0x30b6b000 - 0x30b6cfff  libsystem_blocks.dylib armv7  <ccc041df3de73eafb7a59e74cdb1702b> /usr/lib/system/libsystem_blocks.dylib
0x30c74000 - 0x30c78fff  libGFXShared.dylib armv7  <2c61a8f7e7bf32d890e957d768d769ce> /System/Library/Frameworks/OpenGLES.framework/libGFXShared.dylib
0x30cad000 - 0x30cb0fff  libmacho.dylib armv7  <0479a171c00d3f629d639713acb72b5b> /usr/lib/system/libmacho.dylib
0x30ce1000 - 0x30d01fff  AppleAccount armv7  <4e0ac5cf93b338ab8c5f34ba3c5e2ee4> /System/Library/PrivateFrameworks/AppleAccount.framework/AppleAccount
0x30d1c000 - 0x30d33fff  libsystem_kernel.dylib armv7  <29eb602b615b3c3b95722868100a2d1c> /usr/lib/system/libsystem_kernel.dylib
0x30d34000 - 0x30d79fff  IMAVCore armv7  <d1cd89b130ea37c1aff5973e10abf0fc> /System/Library/PrivateFrameworks/IMAVCore.framework/IMAVCore
0x30d89000 - 0x30d8efff  libnotify.dylib armv7  <9d7198e91de9386a9e5ea43608a66a57> /usr/lib/system/libnotify.dylib
0x30dbb000 - 0x30deefff  AppSupport armv7  <0217468bd9f839229a47910b7816b3d5> /System/Library/PrivateFrameworks/AppSupport.framework/AppSupport
0x30e1f000 - 0x30e70fff  libsqlite3.dylib armv7  <8a41cc6a6d9332308bc415d27577fd24> /usr/lib/libsqlite3.dylib
0x30eb5000 - 0x30ec1fff  SpringBoardServices armv7  <c78c28a259ad35ddb01512beb5fcea95> /System/Library/PrivateFrameworks/SpringBoardServices.framework/SpringBoardServices
0x30ec6000 - 0x30f63fff  AddressBookUI armv7  <e354aeb3d96e30338e90cc3638ffe81b> /System/Library/Frameworks/AddressBookUI.framework/AddressBookUI
0x30f6e000 - 0x30f75fff  libMobileGestalt.dylib armv7  <55f29184efcc3046bb833dd72a4487e1> /usr/lib/libMobileGestalt.dylib
0x30f76000 - 0x310cafff  AudioToolbox armv7  <3b599e96ffe93b1ea2aa6026dee809dc> /System/Library/Frameworks/AudioToolbox.framework/AudioToolbox
0x310cb000 - 0x310d0fff  libcopyfile.dylib armv7  <a19b1caf96c73568b14a1660f147ae2f> /usr/lib/system/libcopyfile.dylib
0x3112b000 - 0x31733fff  WebCore armv7  <9c7e4a156f6a381ea02f99ece48a46fe> /System/Library/PrivateFrameworks/WebCore.framework/WebCore
0x31736000 - 0x31738fff  CrashReporterSupport armv7  <4d521bd4a1be3448a7d2bac1d09c5ff9> /System/Library/PrivateFrameworks/CrashReporterSupport.framework/CrashReporterSupport
0x31751000 - 0x31752fff  libsystem_network.dylib armv7  <39bf0f48bd8539169a77f8f61cdcd4c9> /usr/lib/system/libsystem_network.dylib
0x31753000 - 0x31765fff  TelephonyUI armv7  <4ba8500c2e10351d93a707264e2a5314> /System/Library/PrivateFrameworks/TelephonyUI.framework/TelephonyUI
0x31766000 - 0x317eafff  AVFoundation armv7  <9d5e43475961327384d6218d14de8b1c> /System/Library/Frameworks/AVFoundation.framework/AVFoundation
0x3180f000 - 0x31814fff  MobileKeyBag armv7  <8c35c090bc373cb181fc26b961b8dba5> /System/Library/PrivateFrameworks/MobileKeyBag.framework/MobileKeyBag
0x31831000 - 0x31930fff  PhotoLibrary armv7  <e690b9626613311284d2a848acda89f8> /System/Library/PrivateFrameworks/PhotoLibrary.framework/PhotoLibrary
0x3193c000 - 0x31945fff  MobileWiFi armv7  <5b634ed28af339719e3c279224531ccb> /System/Library/PrivateFrameworks/MobileWiFi.framework/MobileWiFi
0x31947000 - 0x3197bfff  VideoToolbox armv7  <aec2e22a2055380e82d4d0279faad0a7> /System/Library/PrivateFrameworks/VideoToolbox.framework/VideoToolbox
0x3197c000 - 0x31997fff  FTServices armv7  <e23c3572bf3a36a3a99364d18c484f1e> /System/Library/PrivateFrameworks/FTServices.framework/FTServices
0x31998000 - 0x319adfff  libresolv.9.dylib armv7  <e92cfbb83f7b330db19181e797bb3f7b> /usr/lib/libresolv.9.dylib
0x319e3000 - 0x31b04fff  CoreGraphics armv7  <54e27b8aa66c32b48ffeadadcc514331> /System/Library/Frameworks/CoreGraphics.framework/CoreGraphics
0x31b05000 - 0x31b4bfff  CoreTelephony armv7  <2b9ebb05fdea38938dde802c8280b3ea> /System/Library/Frameworks/CoreTelephony.framework/CoreTelephony
0x31b57000 - 0x31b59fff  libgcc_s.1.dylib armv7  <a2631ac302f4310dae8367939e16b7c2> /usr/lib/libgcc_s.1.dylib
0x31b81000 - 0x31b81fff  libCVMSPluginSupport.dylib armv7  <68322643de8030978c862de530055bd9> /System/Library/Frameworks/OpenGLES.framework/libCVMSPluginSupport.dylib
0x31d0e000 - 0x31d19fff  libz.1.dylib armv7  <ac706bee36593dc683fd5a96a389d72e> /usr/lib/libz.1.dylib
0x31d1c000 - 0x31d5ffff  ManagedConfiguration armv7  <ffab9d7f5b5b315085783caf030932bf> /System/Library/PrivateFrameworks/ManagedConfiguration.framework/ManagedConfiguration
0x31d60000 - 0x31e06fff  Celestial armv7  <1d37083fe4253a2fb271c0ca0a42e283> /System/Library/PrivateFrameworks/Celestial.framework/Celestial
0x31e07000 - 0x31e0dfff  IAP armv7  <c0f4c99a1b493e489948f231ad9238e2> /System/Library/PrivateFrameworks/IAP.framework/IAP
0x31e0e000 - 0x31e11fff  ApplePushService armv7  <015c68c15621348db9f6a012499170e1> /System/Library/PrivateFrameworks/ApplePushService.framework/ApplePushService
0x31e89000 - 0x31e96fff  libbsm.0.dylib armv7  <0a1e2bb78d5138419ecad8ba0fe42fdd> /usr/lib/libbsm.0.dylib
0x3201f000 - 0x32024fff  libsystem_dnssd.dylib armv7  <1eaf25ddd98e3a249bca536671c5819d> /usr/lib/system/libsystem_dnssd.dylib
0x32025000 - 0x32032fff  libdispatch.dylib armv7  <6c4eeb08757b365f8429ef6747f89ad3> /usr/lib/system/libdispatch.dylib
0x32038000 - 0x32157fff  Foundation armv7  <60d1a3b3937c3c7ab21d701fb337346c> /System/Library/Frameworks/Foundation.framework/Foundation
0x32167000 - 0x32167fff  vecLib armv7  <0c60cd0a60f43d2791d36cb357d30e3c> /System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/vecLib
0x3216e000 - 0x32192fff  MediaControl armv7  <88f4c8df324a35cab32735927d3082e5> /System/Library/PrivateFrameworks/MediaControl.framework/MediaControl
0x3219c000 - 0x3219dfff  DataMigration armv7  <42e9e87a4e0735c3837e27d4f2adcf55> /System/Library/PrivateFrameworks/DataMigration.framework/DataMigration
0x32353000 - 0x32373fff  PrintKit armv7  <e5a01ca9083a36afacc08611a398e2ad> /System/Library/PrivateFrameworks/PrintKit.framework/PrintKit
0x323a2000 - 0x323d1fff  SystemConfiguration armv7  <1d73b8a159363f96bb9c039655c5eae6> /System/Library/Frameworks/SystemConfiguration.framework/SystemConfiguration
0x323d2000 - 0x324b7fff  CoreFoundation armv7  <4f643539f91f330790f112ea7150b3a8> /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation
0x3250f000 - 0x325d5fff  MusicLibrary armv7  <88f8b1070fbf3cbc80471a432ea1fafb> /System/Library/PrivateFrameworks/MusicLibrary.framework/MusicLibrary
0x326dc000 - 0x32771fff  ImageIO armv7  <d520e3241d1130e8ac1375ee0f2c1095> /System/Library/Frameworks/ImageIO.framework/ImageIO
0x32777000 - 0x3277afff  IOSurface armv7  <ad50e71624583d06b891344d832f9b08> /System/Library/PrivateFrameworks/IOSurface.framework/IOSurface
0x32868000 - 0x3286efff  ProtocolBuffer armv7  <c9798b4dd29335248000d698dea938bd> /System/Library/PrivateFrameworks/ProtocolBuffer.framework/ProtocolBuffer
0x328c1000 - 0x3430ffff  TextInput armv7  <f242acc046073c1598195dd26fd8ad6f> /System/Library/PrivateFrameworks/TextInput.framework/TextInput
0x34322000 - 0x34391fff  ProofReader armv7  <6d843c6aecdd37ae84baa40af8ad7e65> /System/Library/PrivateFrameworks/ProofReader.framework/ProofReader
0x34433000 - 0x3446afff  Security armv7  <163414ba17df347ca76088015010e2c4> /System/Library/Frameworks/Security.framework/Security
0x34487000 - 0x344c3fff  libGLImage.dylib armv7  <79d00adb09de3da991ed21f48f27adb4> /System/Library/Frameworks/OpenGLES.framework/libGLImage.dylib
0x344cc000 - 0x344ccfff  Accelerate armv7  <7d5ad465049136afaa1f0d89aac600bc> /System/Library/Frameworks/Accelerate.framework/Accelerate
0x344dd000 - 0x34527fff  libstdc++.6.dylib armv7  <b2cac408951c3f3c9ba3cf563e54ce81> /usr/lib/libstdc++.6.dylib
0x34528000 - 0x34553fff  IMFoundation armv7  <f1f21bedbf2e3ea38f692abef0005d76> /System/Library/PrivateFrameworks/IMCore.framework/Frameworks/IMFoundation.framework/IMFoundation
0x34554000 - 0x34558fff  libcache.dylib armv7  <36e96d0a7dda330281a43172d0ada49a> /usr/lib/system/libcache.dylib
0x3458f000 - 0x3464bfff  MapKit armv7  <56b5ea34e6753b6f810f34f0a71d84f9> /System/Library/Frameworks/MapKit.framework/MapKit
0x34a5d000 - 0x34b77fff  libicucore.A.dylib armv7  <bada0c2725bb31a483d5adf9aaf1f8df> /usr/lib/libicucore.A.dylib
0x34bcf000 - 0x34c24fff  libvDSP.dylib armv7  <0221caba81a235c5a896a835e2aac047> /System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/libvDSP.dylib
0x34c2e000 - 0x34d5afff  libmecabra.dylib armv7  <113de5f9858c32b8b158bfdc68042a97> /usr/lib/libmecabra.dylib
0x34d98000 - 0x34dd0fff  libCGFreetype.A.dylib armv7  <ccea634795153164a681f0f311f4461d> /System/Library/Frameworks/CoreGraphics.framework/Resources/libCGFreetype.A.dylib
0x34dea000 - 0x34eeefff  JavaScriptCore armv7  <f63386018d703534b766514e4bbbd1d8> /System/Library/PrivateFrameworks/JavaScriptCore.framework/JavaScriptCore
0x34eef000 - 0x34efffff  DataAccessExpress armv7  <66d9047da79a31daa887e6d84c42ecb2> /System/Library/PrivateFrameworks/DataAccessExpress.framework/DataAccessExpress
0x34f00000 - 0x34f02fff  IOMobileFramebuffer armv7  <de8392b1117135e592a16e1cb6d26af5> /System/Library/PrivateFrameworks/IOMobileFramebuffer.framework/IOMobileFramebuffer
0x34f1c000 - 0x3502efff  MediaPlayer armv7  <7b0690d726ec3b10ac4845a8017dba0b> /System/Library/Frameworks/MediaPlayer.framework/MediaPlayer
0x35173000 - 0x35190fff  libsystem_info.dylib armv7  <48016be86e3f3cd9aeee1c6590e1ac6f> /usr/lib/system/libsystem_info.dylib
0x35191000 - 0x351dffff  GMM armv7  <03cb1e098c4932e58b0933dfc58f9116> /System/Library/PrivateFrameworks/GMM.framework/GMM
0x351e9000 - 0x354d0fff  libLAPACK.dylib armv7  <652c97e211553d4e84968a61f62a0ac5> /System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/libLAPACK.dylib
0x354d2000 - 0x354d3fff  libdyld.dylib armv7  <41a7b5e5d9983449ab33affed0f635ad> /usr/lib/system/libdyld.dylib
0x354d4000 - 0x354d7fff  ArtworkCache armv7  <4863e321afee3ac5a3749e50cd926597> /System/Library/PrivateFrameworks/ArtworkCache.framework/ArtworkCache
0x354eb000 - 0x354ebfff  libsystem_sandbox.dylib armv7  <f47c01d627853b328e088b3fdd08e87d> /usr/lib/system/libsystem_sandbox.dylib
0x354ec000 - 0x35533fff  CoreLocation armv7  <565c18af7dfc3c92a63cc4c249913650> /System/Library/Frameworks/CoreLocation.framework/CoreLocation
0x35596000 - 0x355acfff  EAP8021X armv7  <b755ecad7b6a3009a5f4a0fdc5f9bdd7> /System/Library/PrivateFrameworks/EAP8021X.framework/EAP8021X
0x355ec000 - 0x35621fff  AddressBook armv7  <64500984cfb13a098c3c687c37a80fff> /System/Library/Frameworks/AddressBook.framework/AddressBook
0x35622000 - 0x359affff  UIKit armv7  <bc8d14fa59e136b6a28ac025384daf08> /System/Library/Frameworks/UIKit.framework/UIKit
0x35a02000 - 0x35a3ffff  CoreText armv7  <fb6a72faec2330c4b2cd33c2e9c59588> /System/Library/Frameworks/CoreText.framework/CoreText
0x35a41000 - 0x35a46fff  liblaunch.dylib armv7  <f5ccc8234aea3ebd9a88bd37f0fa23ae> /usr/lib/system/liblaunch.dylib
0x35a47000 - 0x35a50fff  CoreVideo armv7  <ea847e6dba2d36b1826b255c73b39539> /System/Library/Frameworks/CoreVideo.framework/CoreVideo
0x35a51000 - 0x35a58fff  AggregateDictionary armv7  <ab9777b39e8e3026ad64dc90323cad7e> /System/Library/PrivateFrameworks/AggregateDictionary.framework/AggregateDictionary
0x35b3c000 - 0x35e4ffff  GeoServices armv7  <8bbb5da6471a3e0d83a55a32c4d1fa9f> /System/Library/PrivateFrameworks/GeoServices.framework/GeoServices
0x35e50000 - 0x35e57fff  libbz2.1.0.dylib armv7  <0a082e1d475432959ba93aa3dbf7fb31> /usr/lib/libbz2.1.0.dylib
0x35e5f000 - 0x35e6dfff  OpenGLES armv7  <f02d1c50f0f33991adb1a2caed02eb77> /System/Library/Frameworks/OpenGLES.framework/OpenGLES
0x35e72000 - 0x35eb1fff  libSystem.B.dylib armv7  <b5735b0f3dba32c087c5b58aa48ae592> /usr/lib/libSystem.B.dylib
0x35eb2000 - 0x35f61fff  QuartzCore armv7  <ef9632c9781f3101916b65e9faae1579> /System/Library/Frameworks/QuartzCore.framework/QuartzCore
0x35f62000 - 0x36021fff  CFNetwork armv7  <84a2d312145e3dbf97aea052927dcdb9> /System/Library/Frameworks/CFNetwork.framework/CFNetwork
0x36022000 - 0x3604cfff  libtidy.A.dylib armv7  <cf55a08bccaa3c5d9576685da0b1c9c7> /usr/lib/libtidy.A.dylib
0x3604d000 - 0x36076fff  MobileCoreServices armv7  <57fef84bdc17301d8bf53ba0fb967fe6> /System/Library/Frameworks/MobileCoreServices.framework/MobileCoreServices
0x36077000 - 0x36090fff  libRIP.A.dylib armv7  <4825c3e392983aba947eca06555e4480> /System/Library/Frameworks/CoreGraphics.framework/Resources/libRIP.A.dylib
0x36091000 - 0x36094fff  MediaRemote armv7  <7db032aa932a348f897110c3c7f27bd8> /System/Library/PrivateFrameworks/MediaRemote.framework/MediaRemote
0x36168000 - 0x361c6fff  libBLAS.dylib armv7  <d3f7360687333cad987890c314ae0d6f> /System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/libBLAS.dylib
0x361de000 - 0x361dffff  libremovefile.dylib armv7  <5f077c4d204d3cd7b04452c42d41f763> /usr/lib/system/libremovefile.dylib
0x36217000 - 0x36298fff  libsystem_c.dylib armv7  <caa1846ad2583d1b84c1a15c50c126a2> /usr/lib/system/libsystem_c.dylib
0x36393000 - 0x36480fff  libiconv.2.dylib armv7  <f4146ce07e3031ea8a81fa5516fd77d0> /usr/lib/libiconv.2.dylib
0x365b2000 - 0x365b4fff  MailServices armv7  <adbbafb0ea513e00ae3c6ec8f0251410> /System/Library/PrivateFrameworks/MailServices.framework/MailServices
0x365b5000 - 0x365edfff  IOKit armv7  <80ae313ad69d3363935c88e51a11862d> /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit
0x36679000 - 0x366aefff  ImageCapture armv7  <3986f84250b5367493945b2d41018620> /System/Library/PrivateFrameworks/ImageCapture.framework/ImageCapture
0x366af000 - 0x36773fff  libobjc.A.dylib armv7  <f855251d90a53bdbb5d5a39fdbde6d9b> /usr/lib/libobjc.A.dylib
0x36779000 - 0x367b9fff  CoreMedia armv7  <66ee3ed5265f3d49a274dc9a07d27d52> /System/Library/Frameworks/CoreMedia.framework/CoreMedia
0x36848000 - 0x3684afff  Marco armv7  <53203fa831ab34f894f3a3811bf3917c> /System/Library/PrivateFrameworks/Marco.framework/Marco
0x3684b000 - 0x3684dfff  libAccessibility.dylib armv7  <d55f1553d14831a2a5435ae27ef75ef4> /usr/lib/libAccessibility.dylib
0x3684e000 - 0x3685cfff  DataDetectorsCore armv7  <e54fa5bf6f9333618401cdbaf665f227> /System/Library/PrivateFrameworks/DataDetectorsCore.framework/DataDetectorsCore
0x3686a000 - 0x3691bfff  WebKit armv7  <8f2fd63295d83121b1db9097938ad31f> /System/Library/PrivateFrameworks/WebKit.framework/WebKit
0x3691c000 - 0x369c5fff  libxml2.2.dylib armv7  <5538d3f2c7d83b88b06168488fe6326b> /usr/lib/libxml2.2.dylib
0x369c6000 - 0x369ccfff  liblockdown.dylib armv7  <14c89b7346433c1f8675f454531f6ca3> /usr/lib/liblockdown.dylib
0x36a4b000 - 0x36a4dfff  SpringBoardUI armv7  <90ba5da3e3e337e0a83e2c2589d951a8> /System/Library/PrivateFrameworks/SpringBoardUI.framework/SpringBoardUI
0x36a4e000 - 0x36b9afff  MediaToolbox armv7  <46c1dd5571de3f7dae97dcde85ca933c> /System/Library/PrivateFrameworks/MediaToolbox.framework/MediaToolbox
0x36ccc000 - 0x36cdffff  libmis.dylib armv7  <529ea6e3a87230ce9f6cf3285c22429c> /usr/lib/libmis.dylib
0x36ce0000 - 0x36d2dfff  CoreMotion armv7  <e0349aa7dd1c3454a970ea1939279801> /System/Library/Frameworks/CoreMotion.framework/CoreMotion
0x36d45000 - 0x36d57fff  PersistentConnection armv7  <6d30b5ef735f36a79cfc82c9b6606db9> /System/Library/PrivateFrameworks/PersistentConnection.framework/PersistentConnection

My code is

-(void) click
{
    imagePicker = [[UIImagePickerController alloc] init]; imagePicker.delegate = self;

    imagePicker.allowsEditing=YES;

    // the user clicked one of the OK/Cancel buttons

    if (buttonIndex == 0) {

        if (![UIImagePickerController isSourceTypeAvailable:
            UIImagePickerControllerSourceTypeCamera]) {

            // Open alert window if there isn't a camera available. Need an iPod Touch to test this.
            UIAlertView *alert = [[UIAlertView alloc]
                          initWithTitle:@"Camera Required"
                          message:@"Your device must have a built-in camera to use this feature."
                          delegate:nil
                          cancelButtonTitle:@"ok" otherButtonTitles:nil];
            [alert show];
            [alert release];
        }
        else
        {

            imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;


            [self presentModalViewController:imagePicker animated:YES];


        }
    }
}

-  (void) imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info 
{

    [picker dismissModalViewControllerAnimated:YES];   
[picker release];

    image = [info  objectForKey:UIImagePickerControllerEditedImage];  

    image=[image imageWithImage:image scaledToSize:CGSizeMake(320, 480)];
    imgvw.image = image;
    image=[image thumbnailImage:150 transparentBorder:5.0 cornerRadius:15 interpolationQuality:kCGInterpolationHigh];
    [selectedButton setImage:image forState:UIControlStateNormal];
    [self uploadImage];
}
iphone
objective-c
ipad
uiimagepickercontroller
asked on Stack Overflow Aug 19, 2011 by Rams • edited Aug 20, 2011 by Rams

1 Answer

1

Try dismissing the picker and releasing it after you retrieve the image taken from the camera.

Besides, if the camera is not available, you're leaking memory by creating the imagepicker and not releasing it in case of an error.

Create the UIImagePickerController autoreleased and don't release it in the imagePickerController:didFinishPickingMediaWithInfo: method, just dismiss it at the end.

The other problem is that in addition to the UIImage holding the original image, you're creating a scaled down one and a thumbnail. Memory pressure may be high in this situation so you should get rid of the images from the memory as soon as possible, especially when you're trying to upload the image right after it's picked so surely the underlying network framework (whatever you're using) is creating another chunk of memory representing the image to be uploaded.

Try to separate the process of picking the image, creating a scaled down and a thumbnail and uploading it by moving those parts of code to separate steps of an NSOperationQueue.

  1. Retrieve the image from the picker and store it to "disk". Release the memory related to the PickerController.
  2. Get the image from disk, create a thumbnail and a scaled down version, store those to disk. Clean up the memory.
  3. Get the scaled down image from disk and upload it.

Don't do everything in the main thread, because your app will get killed by the runtime if it blocks the UI for too long.

answered on Stack Overflow Aug 20, 2011 by macbirdie • edited Aug 20, 2011 by macbirdie

User contributions licensed under CC BY-SA 3.0