1

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: * mmap(size=1048576) failed (error code=12) * 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!

Edit:

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:

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)

Running Time Self Symbol Name 5848.0ms 8.4% 5848.0 +[ASIHTTPRequest runRequests] (my app always get data from sever)

Running Time Self Symbol Name 2169.0ms 3.1% 2169.0 -[BMKUserLocationInternal updateLocationInfo]

Running Time Self Symbol Name 1435.0ms 2.0% 1435.0 -[EGOCache imageForKey:]

Running Time Self Symbol Name 1252.0ms 1.8% 1252.0 -[KLRestDetailViewController tableView:cellForRowAtIndexPath:]

is it userful? how can I check if I stuffing a bunch of stuff?

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

I set a break point and got the messages:

the crash thread messages are not always the same but in the console output, It always said malloc: * mmap(size=1048576) failed (error code=12) error: can't allocate region securely ** set a breakpoint in malloc_error_break to debug

I was so confused by this bug for a few days, any idea? thanks!


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:

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)

Running Time Self Symbol Name 5848.0ms 8.4% 5848.0 +[ASIHTTPRequest runRequests] (my app always get data from sever)

Running Time Self Symbol Name 2169.0ms 3.1% 2169.0 -[BMKUserLocationInternal updateLocationInfo]

Running Time Self Symbol Name 1435.0ms 2.0% 1435.0 -[EGOCache imageForKey:]

Running Time Self Symbol Name 1252.0ms 1.8% 1252.0 -[KLRestDetailViewController tableView:cellForRowAtIndexPath:]

is it userful? how can I check if I stuffing a bunch of stuff?

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

I set a break point and got the messages:

libsystem_c.dylib`malloc_error_break: 0x33c742e8: push {r7, lr}
0x33c742ea: mov r7, sp
0x33c742ec: nop

0x33c742ee: nop
0x33c742f0: pop {r7, pc}
0x33c742f2: nop
0x3393ed86: movs r2, #0
0x3393ed88: ldr r0, [r0]
0x3393ed8a: ldr r0, [r4, r0]
0x3393ed8c: blx 0x33aaf1c0; symbol stub for: -[NSUUID copyWithZone:]
0x3393ed90: movw r0, #52700
0x3393ed94: movt r0, #1571
0x3393ed98: add r0, pc
0x3393ed9a: ldr r1, [r0]

0x23ac72: mov r0, r5
0x23ac74: str.w r8, [sp]
0x23ac78: blx 0x2c7d04 ; symbol stub for: objc_msgSend
0x23ac7c: b 0x23aca4 ; -[BMKUserLocationInternal updateLocationInfo]
+ 912 at BMKUserLocationInternal.mm:131
0x23ac7e: bl 0x1cbcd8 ; bmengine::GetGlobalMan() at
IphoneBaiduMaps.mm:61

0x33941b7e: mov r0, r11
0x33941b80: mov r1, r8
0x33941b82: mov r2, r10
0x33941b84: blx 0x33aace80 ; symbol stub for: CFDictionarySetValue$shim
0x33941b88: movw r0, #36884
0x33941b8c: movt r0, #1571
0x33941b90: add r0, pc
0x33941b92: ldr r4, [r0]
0x33941b94: mov r0, r11

0x23acd6: movs r3, #1
0x23acd8: str r3, [sp]
0x23acda: movs r3, #0
0x23acdc: blx 0x2c7d04 ; symbol stub for: objc_msgSend
0x23ace0: add sp, #4
0x23ace2: pop {r7, pc}

0x35bee92e: ldr r1, [sp, #224]
0x35bee930: ldr r2, [sp, #136]
0x35bee932: ldr r3, [sp, #232]
0x35bee934: blx 0x35c268e4 ; symbol stub for:
CLLocationDictionaryUtilitiesGetTransitionInterval
0x35bee938: movw r0, #1732
0x35bee93c: movt r0, #1078
0x35bee940: add r0, pc
0x35bee942: ldr r1, [r0]

the crash thread messages are not always the same but in the console output, It always said malloc: * mmap(size=1048576) failed (error code=12) error: can't allocate region securely ** set a breakpoint in malloc_error_break to debug

I was so confused by this bug for a few days, any idea? thanks!

casperOne
  • 73,706
  • 19
  • 184
  • 253
user1923740
  • 11
  • 1
  • 3
  • 1
    What did your memory usage look like? It's possible that you don't have any leaks, but that you're just holding on to a ton of memory that you don't need to. It's only a leak if there are no pointers in your app's address space pointing to it. But if you are, for example, stuffing a bunch of stuff into an `NSArray` that you'll never use again, technically that's not a leak because the array has a reference to it. – user1118321 Dec 22 '12 at 15:43
  • Run your app with the time profiler, figure out what methods are taking up most of the resources and paste the code so we can help – Stavash Dec 22 '12 at 16:05
  • May be you can check this http://stackoverflow.com/questions/8477236/malloc-error-cant-allocate-region-failed-with-error-code-12-any-idea-how-to – JiteshW Mar 20 '13 at 09:18

0 Answers0