Program received signal: “EXC_BAD_ACCESS”.
(gdb) bt
#0 0x30011940 in objc_msgSend ()
#1 0x30235f24 in CFRelease ()
#2 0x308f497c in -[UIImage dealloc] ()
#3 0x30236b78 in -[NSObject release] ()
#4 0x30a002a0 in FlushNamedImage ()
#5 0x30250a26 in CFDictionaryApplyFunction ()
#6 0x30a001a4 in _UISharedImageFlushAll ()
#7 0x30a00738 in +[UIImage(UIImageInternal) _flushCacheOnMemoryWarning:] ()
#8 0x3054dc80 in _nsnote_callback ()
#9 0x3024ea58 in _CFXNotificationPostNotification ()
#10 0x3054b85a in -[NSNotificationCenter postNotificationName:object:userInfo:] ()
#11 0x3054dbc0 in -[NSNotificationCenter postNotificationName:object:] ()
#12 0x30a00710 in -[UIApplication _performMemoryWarning] ()
#13 0x30a006a8 in -[UIApplication _receivedMemoryNotification] ()
#14 0x30a005d8 in _memoryStatusChanged ()
#15 0x30217416 in __CFNotificationCenterDarwinCallBack ()
#16 0x3020d0b0 in __CFMachPortPerform ()
#17 0x30254a76 in CFRunLoopRunSpecific ()
#18 0x3025416a in CFRunLoopRunInMode ()
#19 0x320452a4 in GSEventRunModal ()
#20 0x308f037c in -[UIApplication _run] ()
#21 0x308eea94 in UIApplicationMain ()
#22 0x00002096 in main (argc=1, argv=0x2ffff514)
Currently I have a very weird error in my program. Sometimes it happens, and sometimes, it doesn't. But here's a summary of what's going on:
When the program starts up:
- saved data (just a short plist consists of 13 elements) is loaded if it exists.
- a huge plist containing 1014 strings is loaded into NSMutableDictionary.
- another plist containing 78 strings is loaded into an NSArray.
- a .mp4 movie is played.
The error occurs at a part where OpenGL ES View is being removed and the user is about to view one of the strings of the 1014 strings in the NSMutableDictionary.
This error never occur in the simulator. It only occur on the iPhone, and sometimes it runs fine but sometimes it crushes.
However, after reading the stacktrace, I see CFDictionaryApplyFunction in there, so I thought it might be one of the possible causes. Is it because on the simulator, it reads things so fast that the whole dictionary from the plist is loaded at an instant, while on the device, it reads slower? Honestly, I do not know exactly how the dictionary works. Does it read through all 1014 strings at an instant, or it uses some other threads to read slowly? Please advice. Thank you.