title: malloc: *** mmap(size=1048576) failed (error code=12) *** error: can't allocate region securely
body: <p>I have a app, when I had run it for a few minutes, it always crashed. I check the crash log, it always said
  malloc: <strong>* mmap(size=1048576) failed (error code=12)
  *</strong> error: can't allocate region securely
  I checked the memory leaks by using the instruments tools, but did not find any memory leak. I wonder if there are some memory leaks the instruments can not find, or some other reasons for the crash. 
  any help will be appreciated!</p>
  
  <p><strong>Edit:</strong></p>
  
  <p>I used the time profiler to check the performance. but I don't know what's the key point because the top items are these:</p>
  
  <p>Running Time    Self        Symbol Name
  6494.0ms    9.4%    6494.0      -[DLStarView initWithDefault:highlighted:position:allowFractions:]
  (my app has a lot of list, each item has a self made star view)</p>
  
  <p>Running Time    Self        Symbol Name
  5848.0ms    8.4%    5848.0      +[ASIHTTPRequest runRequests] 
  (my app always get data from sever)</p>
  
  <p>Running Time    Self        Symbol Name
  2169.0ms    3.1%    2169.0      -[BMKUserLocationInternal updateLocationInfo]</p>
  
  <p>Running Time    Self        Symbol Name
  1435.0ms    2.0%    1435.0      -[EGOCache imageForKey:]</p>
  
  <p>Running Time    Self        Symbol Name
  1252.0ms    1.8%    1252.0      -[KLRestDetailViewController tableView:cellForRowAtIndexPath:]</p>
  
  <p>is it userful? how can I check if I stuffing a bunch of stuff?</p>
  
  <p>PS: this crash only appear on the real device, I ran it in the simulator for about 20 minutes and the app still run smoothly, my device is iPhone4S iOS 6.0.1</p>
  
  <p>I set a break point and got the messages:</p>
  
  <p>the crash thread messages are not always the same
  but in the console output, It always said 
  malloc: <strong>* mmap(size=1048576) failed (error code=12)
  <em></strong> error: can't allocate region securely
  *</em>* set a breakpoint in malloc_error_break to debug</p>
  
  <p>I was so confused by this bug for a few days, any idea? thanks!</p>
  
  <hr>
  
  <p>I used the time profiler to check the performance. but I don't know what's the key point because the top items are these:</p>
  
  <p>Running Time    Self        Symbol Name
  6494.0ms    9.4%    6494.0      -[DLStarView initWithDefault:highlighted:position:allowFractions:]
  (my app has a lot of list, each item has a self made star view)</p>
  
  <p>Running Time    Self        Symbol Name
  5848.0ms    8.4%    5848.0      +[ASIHTTPRequest runRequests] 
  (my app always get data from sever)</p>
  
  <p>Running Time    Self        Symbol Name
  2169.0ms    3.1%    2169.0      -[BMKUserLocationInternal updateLocationInfo]</p>
  
  <p>Running Time    Self        Symbol Name
  1435.0ms    2.0%    1435.0      -[EGOCache imageForKey:]</p>
  
  <p>Running Time    Self        Symbol Name
  1252.0ms    1.8%    1252.0      -[KLRestDetailViewController tableView:cellForRowAtIndexPath:]</p>
  
  <p>is it userful? how can I check if I stuffing a bunch of stuff?</p>
  
  <p>PS: this crash only appear on the real device, I ran it in the simulator for about 20 minutes and the app still run smoothly, my device is iPhone4S iOS 6.0.1</p>
  
  <p>I set a break point and got the messages:</p>
  
  <p>libsystem_c.dylib`malloc_error_break:
  0x33c742e8:  push   {r7, lr}<br>
  0x33c742ea:  mov    r7, sp<br>
  0x33c742ec:  nop <br><br>
  0x33c742ee:  nop  <br> 
  0x33c742f0:  pop    {r7, pc} <br>
  0x33c742f2:  nop    <br>
  0x3393ed86:  movs   r2, #0 <br>
  0x3393ed88:  ldr    r0, [r0]<br>
  0x3393ed8a:  ldr    r0, [r4, r0]<br>
  0x3393ed8c:  blx    0x33aaf1c0; symbol stub for: -[NSUUID copyWithZone:]<br>
  0x3393ed90:  movw   r0, #52700<br>
  0x3393ed94:  movt   r0, #1571<br>
  0x3393ed98:  add    r0, pc<br>
  0x3393ed9a:  ldr    r1, [r0]<br></p>
  
  <p>0x23ac72:  mov    r0, r5<br>
  0x23ac74:  str.w  r8, [sp]<br>
  0x23ac78:  blx    0x2c7d04                  ; symbol stub for: objc_msgSend<br>
  0x23ac7c:  b      0x23aca4                  ; -[BMKUserLocationInternal updateLocationInfo] <br>+ 912 at BMKUserLocationInternal.mm:131<br>
  0x23ac7e:  bl     0x1cbcd8                  ; bmengine::GetGlobalMan() at <br>IphoneBaiduMaps.mm:61</p>
  
  <p>0x33941b7e:  mov    r0, r11<br>
  0x33941b80:  mov    r1, r8<br>
  0x33941b82:  mov    r2, r10<br>
  0x33941b84:  blx    0x33aace80                ; symbol stub for: CFDictionarySetValue$shim<br>
  0x33941b88:  movw   r0, #36884<br>
  0x33941b8c:  movt   r0, #1571<br>
  0x33941b90:  add    r0, pc<br>
  0x33941b92:  ldr    r4, [r0]<br>
  0x33941b94:  mov    r0, r11<br></p>
  
  <p>0x23acd6:  movs   r3, #1<br>
  0x23acd8:  str    r3, [sp]<br>
  0x23acda:  movs   r3, #0<br>
  0x23acdc:  blx    0x2c7d04                  ; symbol stub for: objc_msgSend<br>
  0x23ace0:  add    sp, #4<br>
  0x23ace2:  pop    {r7, pc}<br></p>
  
  <p>0x35bee92e:  ldr    r1, [sp, #224]<br>
  0x35bee930:  ldr    r2, [sp, #136]<br>
  0x35bee932:  ldr    r3, [sp, #232]<br>
  0x35bee934:  blx    0x35c268e4                ; symbol stub for: <br>CLLocationDictionaryUtilitiesGetTransitionInterval<br>
  0x35bee938:  movw   r0, #1732<br>
  0x35bee93c:  movt   r0, #1078<br>
  0x35bee940:  add    r0, pc<br>
  0x35bee942:  ldr    r1, [r0]<br></p>
  
  <p>the crash thread messages are not always the same
  but in the console output, It always said 
  malloc: <strong>* mmap(size=1048576) failed (error code=12)
  <em></strong> error: can't allocate region securely
  *</em>* set a breakpoint in malloc_error_break to debug</p>
  
  <p>I was so confused by this bug for a few days, any idea? thanks!</p>