Need help to Analyse the Crash : libsystem_malloc.dylib

Hello,


I am getting crash with following details.

Crash occurs on only 10.13 Mac OS version. For earlier versions of Mac OS functionality is working fine .


Many times the crash occurs at different execution flow but in same library i.e. libsystem_malloc.dylib.

Can someone guide me to debug this crash and resolve the issue?



—————————————————————————————————

Crash Sample 1 :


Crashed Thread: 6


Exception Type: EXC_BAD_INSTRUCTION (SIGILL)

Exception Codes: 0x0000000000000001, 0x0000000000000000

Exception Note: EXC_CORPSE_NOTIFY


Termination Signal: Illegal instruction: 4

Termination Reason: Namespace SIGNAL, Code 0x4

Terminating Process: exc handler [0]



Thread 6 Crashed:

0 libsystem_malloc.dylib 0xa7441dd4 small_free_list_remove_ptr_no_clear + 570

1 libsystem_malloc.dylib 0xa7436ad7 small_free_list_remove_ptr + 163

2 libsystem_malloc.dylib 0xa7436768 small_malloc_from_free_list + 425

3 libsystem_malloc.dylib 0xa7434da8 szone_malloc_should_clear + 1498

4 libsystem_malloc.dylib 0xa74347c9 szone_malloc + 24

5 libsystem_malloc.dylib 0xa7443d5c default_zone_malloc + 49

6 libsystem_malloc.dylib 0xa743475b malloc_zone_malloc + 110

7 dbopr.dylib 0x0022acd9 sqlite3MemMalloc + 36

8 dbopr.dylib 0x00221c24 mallocWithAlarm + 149

9 dbopr.dylib 0x0021442a sqlite3Malloc + 77

10 dbopr.dylib 0x0021dc1a sqlite3RunParser + 75

11 dbopr.dylib 0x0025c5da sqlite3Prepare + 278

12 dbopr.dylib 0x0021d2e8 sqlite3LockAndPrepare + 110

13 dbopr.dylib 0x0021c893 sqlite3_exec + 274

14 dbopr.dylib 0x0021d5fb sqlite3_get_table + 175

15 dbopr.dylib 0x00212f96 CppSQLite3DB::getTable(char const*) + 100

16 mythread.dylib 0x000153b3 MyMgtThreadtThread(void*) + 696

17 libsystem_pthread.dylib 0xa75914d5 _pthread_body + 347

18 libsystem_pthread.dylib 0xa759137a _pthread_start + 357

19 libsystem_pthread.dylib 0xa7590a56 thread_start + 34


—————————————————————————————————

Crash sample 2


Crashed Thread: 6


Exception Type: EXC_BAD_INSTRUCTION (SIGILL)

Exception Codes: 0x0000000000000001, 0x0000000000000000

Exception Note: EXC_CORPSE_NOTIFY


Termination Signal: Illegal instruction: 4

Termination Reason: Namespace SIGNAL, Code 0x4

Terminating Process: exc handler [0]



Thread 6 Crashed:

0 libsystem_malloc.dylib 0xa7441dd4 small_free_list_remove_ptr_no_clear + 570

1 libsystem_malloc.dylib 0xa7436ad7 small_free_list_remove_ptr + 163

2 libsystem_malloc.dylib 0xa7436768 small_malloc_from_free_list + 425

3 libsystem_malloc.dylib 0xa7434da8 szone_malloc_should_clear + 1498

4 libsystem_malloc.dylib 0xa74347c9 szone_malloc + 24

5 libsystem_malloc.dylib 0xa7443d5c default_zone_malloc + 49

6 libsystem_malloc.dylib 0xa743475b malloc_zone_malloc + 110

7 libsystem_malloc.dylib 0xa7433d9e malloc + 29

8 libxml2.2.dylib 0xa70038df xmlBufCreate + 95

9 libxml2.2.dylib 0xa7070c76 xmlAllocOutputBuffer + 66

10 libxml2.2.dylib 0xa70841e1 xmlDocDumpFormatMemoryEnc + 161

11 libxml2.2.dylib 0xa7084370 xmlDocDumpFormatMemory + 28

12 getxmlDetails.dylib 0x000666ce GetxmlDetails(char*, char*, unsigned int*) + 778

13 mythread.dylib 0x000153b3 MyMgtThreadtThread(void*) + 656

14 libsystem_pthread.dylib 0xa75914d5 _pthread_body + 347

15 libsystem_pthread.dylib 0xa759137a _pthread_start + 357

16 libsystem_pthread.dylib 0xa7590a56 thread_start + 34



Thanks ,

Simran

Replies

Crashes within

libsystem_malloc
are almost always the result of memory management problems, which means your first step should be to run the standard memory debugging tools against your app.

Notwithstanding the above, the fact that the backtrace of this crash leads to your code (frame 12,

GetxmlDetails(char*, char*, unsigned int*)
), and that code is working with a low-level C API (
libxml2
), and C APIs always present sharp memory management edges, should give you a place to start investigating.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"