Post not yet marked as solved
Click to stop watching this thread.
You have stopped watching this post. Click to start watching again.
contentPostList.repliesup-voted.tooltip
I'm having a similar issue. I created a simple xcode app project in objective c. I renamed my appdelegate source file to AppDelegate.mm to accept c++ code then included the following in the applicationDidFinishLaunching method:
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
// Insert code here to initialize your application
NSLog(@"bf new");
UInt8 * b = new UInt8[512];
NSLog(@"af new");
delete[] b;
NSLog(@"af del");
}
the app crashes on UInt8 * b = new UInt8[512] alerting me of some memory corruption:
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Termination Signal: Segmentation fault: 11
Termination Reason: Namespace SIGNAL, Code 0xb
Terminating Process: exc handler [518]
VM Regions Near 0:
-->
__TEXT 104be0000-104be4000 [ 16K] r-x/r-x SM=COW /Volumes/*/crash2.app/Contents/MacOS/crash2
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 ??? 000000000000000000 0 + 0
1 com.apple.CoreFoundation 0x000000019da365c4 __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 28
2 com.apple.CoreFoundation 0x000000019dad85a0 ___CFXRegistrationPost_block_invoke + 52
3 com.apple.CoreFoundation 0x000000019dad850c _CFXRegistrationPost + 456
4 com.apple.CoreFoundation 0x000000019da0507c _CFXNotificationPost + 720
5 com.apple.Foundation 0x000000019e792370 -[NSNotificationCenter postNotificationName:object:userInfo:] + 64
6 com.apple.AppKit 0x00000001a023f710 -[NSApplication _postDidFinishNotification] + 340
7 com.apple.AppKit 0x00000001a023f428 -[NSApplication _sendFinishLaunchingNotification] + 236
8 com.apple.AppKit 0x00000001a023c514 -[NSApplication(NSAppleEventHandling) _handleAEOpenEvent:] + 580
9 com.apple.AppKit 0x00000001a023c0fc -[NSApplication(NSAppleEventHandling) _handleCoreEvent:withReplyEvent:] + 780
10 com.apple.Foundation 0x000000019e7bf1c4 -[NSAppleEventManager dispatchRawAppleEvent:withRawReply:handlerRefCon:] + 344
11 com.apple.Foundation 0x000000019e7beffc _NSAppleEventManagerGenericHandler + 96
12 com.apple.AE 0x00000001a36e0850 0x1a36d4000 + 51280
13 com.apple.AE 0x00000001a36e00cc 0x1a36d4000 + 49356
14 com.apple.AE 0x00000001a36d8b80 aeProcessAppleEvent + 520
15 com.apple.HIToolbox 0x00000001a597e62c AEProcessAppleEvent + 68
16 com.apple.AppKit 0x00000001a0236410 _DPSNextEvent + 1836
17 com.apple.AppKit 0x00000001a02349c8 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1292
18 com.apple.AppKit 0x00000001a0226814 -[NSApplication run] + 596
19 com.apple.AppKit 0x00000001a01f8240 NSApplicationMain + 1064
20 brando.crash2 0x0000000104be2ff4 main + 44
21 libdyld.dylib 0x000000019d961430 start + 4
This only happens when I build using Xcode 15.0 and run on macOS 11.7.10. Other macOS versions work fine. I believe my issue may be related to yours because your crash is happening in some initialization process.