{"id":5272,"date":"2014-03-30T20:14:24","date_gmt":"2014-03-30T20:14:24","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/canceling-call-as-the-malloc-lock-is-held-so-it-isnt-safe-to-call-the-runtime-in-ios-collection-of-common-programming-errors\/"},"modified":"2014-03-30T20:14:24","modified_gmt":"2014-03-30T20:14:24","slug":"canceling-call-as-the-malloc-lock-is-held-so-it-isnt-safe-to-call-the-runtime-in-ios-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/canceling-call-as-the-malloc-lock-is-held-so-it-isnt-safe-to-call-the-runtime-in-ios-collection-of-common-programming-errors\/","title":{"rendered":"Canceling call as the malloc lock is held so it isn&#39;t safe to call the runtime &#8211; in iOS-Collection of common programming errors"},"content":{"rendered":"<p>When I was converting a char * to NSString in my App, I got this strage error:<\/p>\n<p>Canceling call as the malloc lock is held so it isn&#8217;t safe to call the runtime<\/p>\n<p>The GDB gave me the below information.<\/p>\n<p><strong>Canceling call as the malloc lock is held so it isn&#8217;t safe to call the runtime. Issue the command: set objc-non-blocking-mode off to override this check if you are sure your call doesn&#8217;t use the malloc libraries or the ObjC runtime.<\/strong><\/p>\n<p>Why this happens?<\/p>\n<p>The code I used here is:<\/p>\n<pre><code>objcResponse.desc = [NSString stringWithCString:info-&gt;desc encoding:NSUTF8StringEncoding];\n<\/code><\/pre>\n<p>objCResponse is an Objective C entity and info is an C++ entity (class).<\/p>\n<p><strong>Other information:<\/strong><\/p>\n<p>I am using NSOperationQueue in my App to make calls to SOAP Web service. I also get the below error if I used this code:<\/p>\n<pre><code> char *value = info-&gt;desc;\n    objcResponse.desc = [NSString stringWithCString:value encoding:NSUTF8StringEncoding];\n<\/code><\/pre>\n<p><strong>Attempting to create USE_BLOCK_IN_FRAME variable with block that isn&#8217;t in the frame.<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>When I was converting a char * to NSString in my App, I got this strage error: Canceling call as the malloc lock is held so it isn&#8217;t safe to call the runtime The GDB gave me the below information. Canceling call as the malloc lock is held so it isn&#8217;t safe to call the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-5272","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/5272","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=5272"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/5272\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=5272"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=5272"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=5272"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}