FROM : Scott Ellsworth
DATE : Tue Jul 11 21:55:20 2006
Hi, all.
I am putting together a Cocoaheads presentation, and ran into two
interesting things.
First off, when I use NSZombieEnabled, it acts as expected with non
bridged objects. I hit a breakpoint at the point where my code uses
a zombie:
NSLog(@"Using zombie object");
Worker * worker = [[Worker alloc] init];
[worker release];
int i = [worker addOne:1];
I tried the same thing with an NSString, and with CFZombieLevel (1,
19, 5, and a few other values based on the tech note), and all I got
were bad access exceptions.
NSString * string = [[NSString alloc] initWithFormat:@"String %d", 12];
[string release];
[string length];
Should I have expected this?
Question two:
Setting a breakpoint on -[NSException raise] works great - the
following code breaks where I expect:
NSLog(@"Raising exception");
NSException *badness = [NSException
exceptionWithName:@"RaisedException"
reason:@"Raised an exception"
userInfo:nil];
[badness raise];
Setting a breakpoint on objc_exception_throw() does not work with the
following code. I end up breaking in [NSException raise] called from
mouseDown, not in my action method.
NSLog(@"Throwing exception");
NSException *badness = [NSException
exceptionWithName:@"ThrownException"
reason:@"Threw an exception"
userInfo:nil];
@throw badness;
Latest xcode, version 2.3, MacBook Pro, 10.4.7.
Scott
---
<email_removed>
"When a great many people are unable to find work, unemployment
results" - Calvin Coolidge, (Stanley Walker, City Editor, p. 131 (1934))
DATE : Tue Jul 11 21:55:20 2006
Hi, all.
I am putting together a Cocoaheads presentation, and ran into two
interesting things.
First off, when I use NSZombieEnabled, it acts as expected with non
bridged objects. I hit a breakpoint at the point where my code uses
a zombie:
NSLog(@"Using zombie object");
Worker * worker = [[Worker alloc] init];
[worker release];
int i = [worker addOne:1];
I tried the same thing with an NSString, and with CFZombieLevel (1,
19, 5, and a few other values based on the tech note), and all I got
were bad access exceptions.
NSString * string = [[NSString alloc] initWithFormat:@"String %d", 12];
[string release];
[string length];
Should I have expected this?
Question two:
Setting a breakpoint on -[NSException raise] works great - the
following code breaks where I expect:
NSLog(@"Raising exception");
NSException *badness = [NSException
exceptionWithName:@"RaisedException"
reason:@"Raised an exception"
userInfo:nil];
[badness raise];
Setting a breakpoint on objc_exception_throw() does not work with the
following code. I end up breaking in [NSException raise] called from
mouseDown, not in my action method.
NSLog(@"Throwing exception");
NSException *badness = [NSException
exceptionWithName:@"ThrownException"
reason:@"Threw an exception"
userInfo:nil];
@throw badness;
Latest xcode, version 2.3, MacBook Pro, 10.4.7.
Scott
---
<email_removed>
"When a great many people are unable to find work, unemployment
results" - Calvin Coolidge, (Stanley Walker, City Editor, p. 131 (1934))
| Related mails | Author | Date |
|---|---|---|
| Scott Ellsworth | Jul 11, 21:55 | |
| Nick Zitzmann | Jul 11, 22:17 | |
| Scott Ellsworth | Jul 11, 22:23 | |
| Chris Suter | Jul 11, 23:07 | |
| Sean McBride | Jul 11, 23:09 | |
| Sean McBride | Jul 11, 23:15 | |
| Scott Ellsworth | Jul 12, 00:00 |






Cocoa mail archive

