Hello list, I have a Mac app which was going well until I tried to add a web view. It was giving me a lot of trouble, so I've left it out for the moment. However, after I tried to remove it, my app stopped working. My debug console shows this error, which happens after the main view controller's viewDidLoad method runs:
Cinnamon(1775,0x10086b000) malloc: *** mach_vm_map(size=72018011619328) failed (error code=3) *** error: can't allocate region *** set a breakpoint in malloc_error_break to debug
I'm not sure how to fix this. There's nothing in my debug navigator at all, and no file seems to be showing any errors.
I'm not asking for help with this specific error; rather, how do I diagnose and fix it, and others like it that happen in future, on my own? I can set a breakpoint, but what does it mean to do so in malloc_error_break? How might I go about finding some kind of stack trace? Would zombies help here, and how do I set them up (all instructions I find are for Xcode 4.x)? Are there any other tools in Xcode for debugging I should look into?
I can use the errors that show up next to a source code file, and I can use the debug navigator. That, combined with the debug console, is usually enough, but sometimes--like now--heavier artillery seems to be required. Any ideas or resources would be great. Thanks.
So the debug navigator as you’ve probably usually used it works by you setting breakpoints in your code. I do it by clicking in the margin on the source line I want, I assume that action is accessible in some way which mirrors that workflow.
However you can also set symbolic breakpoints, that just says ‘please stop at the function name xxx’. You don’t have to find the function yourself, it doesn’t have to be in your code. In Xcode, in the debug navigator, where the list of active breakpoints is, at the bottom of that screen is a small plus button next to the filter field which pulls up a menu which has, as one option, ‘add symbolic breakpoint’. In the resulting dialog box you can put in the name of the symbol you wish to break on. When it gets there it will break and you will have a stack trace. I don’t know how you navigate to that button, but perhaps knowing what it says helps.
You should also be able to break the program before it fails and just type ‘b malloc_error_break’ into the console. That should set a breakpoint directly in lldb for that session. When it hits that it’s just like any other breakpoint, debugger stops and you get a stack trace. |