gdb balks because "the malloc lock is held."
gdb balks because "the malloc lock is held."
- Subject: gdb balks because "the malloc lock is held."
- From: Fritz Anderson <email@hidden>
- Date: Tue, 2 Feb 2010 10:45:10 -0600
Mac OS X 10.6.2, Xcode 3.2.1, 10.6 SDK, RC
This issue apparently intersects gdb, Cocoa memory management, and Cocoa callbacks, but I'll try here first.
I have an object that is a delegate for both NSURLConnection and NSXMLParser. The download is of some XML via HTTP; as the XML is parsed, it generates and initializes NSManagedObjects.
I find that when I break in my NSXMLParserDelegate methods, the Debugger does not display summary values for (for instance) method arguments. For example, the contents of element name in -parser:didStartElement:... does not display; address yes, contents no. The contents are present, because comparison of the string with static strings triggers if statements as expected. If I po (gdb print-object) on the element name, or NSLog() it, gdb says:
> Cancelling call as the malloc lock is held so it isn't safe to call the runtime.
> Set objc-non-blocking-mode to off to override this check if you are sure your call doesn't use the ObjC runtime.
Originally, I ran the parser from the NSURLConnection's connectionDidFinishDownloading: callback, but I tried starting the parser on the next pass of the runloop via performSelector:withObject:afterDelay:; doing so didn't help.
My loading/parsing object calls back to a delegate of its own, once -[NSXMLParser parse] returns. The callback also sees the malloc-lock problem, even when it's called on a delay.
Googling 'Xcode "malloc lock"' didn't turn up anything of apparent interest.
"set objc-non-blocking-mode off" does restore the expected behavior, at least with respect to po. Still, I am worried that this indicates that my program is in a bad state that I should correct.
LATER: Oh, and now, with objc-non-blocking-mode at the default "limited," gdb will po, with the warning "Allowing all threads to run to avoid the possible deadlock." I'm not sure what I did.
And another thing: I'm running two download/parses concurrently from the main run loop.
Comments?
— F
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden