Quantcast
Channel: Active questions tagged crash - Stack Overflow
Viewing all articles
Browse latest Browse all 7191

How to fix a malloc error that only occurs on MacOS High Sierra (10.13.6)?

$
0
0

I have been struggling with a malloc error the past few days and I am running out of ideas on a solution. The project (recreation of doom nukem in C and SDL2) runs fine on macOS Mojave and Catalina (exact versions idk), but crashes on my OS (High Sierra 10.13.6). We are compiling with clang.

The error:

doom(76767,0x7fff9d07c380) malloc: *** error for object 0x7fe50486b800: incorrect checksum for freed object - object was probably modified after being freed.*** set a breakpoint in malloc_error_break to debug[1]    76767 abort      ./doom

I have tried scoping down the exact lines where the error occurs, and it seems there are freed variables being accessed throughout the program, even though I got rid of all calls to free() (for testing purposes). That is where I'm starting to get hopeless.

How can something like this occur? I read in a different SO post the problem might not be an invalid free, but a wrong malloc. How would you guys approach finding a solution to this? Also, why is this problem only occuring on 10.13 and not on mojave and catalina?

It's kinda hard to post code examples since there isn't one specific line that causes the problem. If you would like to have a look at the code I'll be happy to send you a github link.

Valgrind output:

==81281== Command: ./doom==81281==--81281-- UNKNOWN mach_msg unhandled MACH_SEND_TRAILER option--81281-- UNKNOWN mach_msg unhandled MACH_SEND_TRAILER option (repeated 2 times)--81281-- UNKNOWN mach_msg unhandled MACH_SEND_TRAILER option (repeated 4 times)==81281== valgrind: Unrecognised instruction at address 0x103bd1b7b.==81281==    at 0x103BD1B7B: _dispatch_kq_poll (in /usr/lib/system/libdispatch.dylib)==81281==    by 0x103BD1741: _dispatch_kq_drain (in /usr/lib/system/libdispatch.dylib)==81281==    by 0x103BD0B0F: _dispatch_kq_unote_update (in /usr/lib/system/libdispatch.dylib)==81281==    by 0x103BCBE3E: _dispatch_source_refs_register (in /usr/lib/system/libdispatch.dylib)==81281==    by 0x103BCBF68: _dispatch_source_finalize_activation (in /usr/lib/system/libdispatch.dylib)==81281==    by 0x103BC4F54: _dispatch_queue_resume_finalize_activation (in /usr/lib/system/libdispatch.dylib)==81281==    by 0x103FFC581: _notify_lib_init (in /usr/lib/system/libsystem_notify.dylib)==81281==    by 0x103FFCB89: notify_register_dispatch (in /usr/lib/system/libsystem_notify.dylib)==81281==    by 0x10079BD07: CFUniCharPrecompose (in /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation)==81281==    by 0x103BB3DB7: _dispatch_client_callout (in /usr/lib/system/libdispatch.dylib)==81281==    by 0x103BB3D6A: dispatch_once_f (in /usr/lib/system/libdispatch.dylib)==81281==    by 0x10079BBBD: CFUniCharPrecompose (in /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation)```

Viewing all articles
Browse latest Browse all 7191

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>