On 28 Mar 2011, at 9:59 AM, Jean-Denis Muys wrote: - the crash happens when stepping over this code line: [self drawInRect:destRect]; where "self" is a UIImage - the app display all go away, showing the springboard. - the Xcode button is still enabled, suggesting that my app is still running. - the debugger console doesn't report anything *at all*: no error, no exception, nothing - the debug navigator is empty and only shows "Process Running" - the pause/continue button is in its "continue" state (right pointing arrow), just as it was before stepping over. pressing it does nothing - pressing my app icon on the device's multitasking bar restarts it from scratch. - pressing Xcode's stop button seems to kill the app, but without any additional output in the debugger console
The code is from a small category I wrote on UIImage to draw thumbnails for images. It's quite straightforward and shown entirely below.
My suspicion is that this problem is memory related, as the image I am trying to scale down here is 6622x9361 pixels in a 6 MB JPEG file.
Um, yeah. That image would require about 248 million bytes to render in memory; JPEGs are compressed when they're files, but to work with them, they have to be rendered into big bad bitmaps. 248M is (to understate) a large chunk of the RAM on most devices.
If you run yourself out of memory, you will be evicted. No warning (if you do it all at once), no console message, you're dead. Apparently Xcode 4 doesn't catch up to the death of the process, and the debugging session has to be stopped manually.
You don't see it in the Simulator because the Simulator, and the apps it runs, are Mac OS X applications. They have access to many times the RAM your device has, backed with a swapping virtual memory system. You can't (unless you try) run a simulated app out of memory.
In the Device Organizer, select the "Device Logs" item for your test device. A crash log for your app will appear in the listing, but all it's going to tell you is that you ran out of memory. You know that.
Run your app under Instruments, with the Allocations template. Adjust the VM instrument to sample every second or so instead of manually. Run your app, and look particularly at the "dirty" memory, which is the actual burden on RAM. That will give you a clue to what's eating up memory.
But you already know: You're trying to fill a quarter-gigabyte of RAM on a non-swapping machine that doesn't have that much memory to spare.
— F
|