[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

zombie debugging idea....

From: Lloyd Dupont
Subject: zombie debugging idea....
Date: Tue, 11 Apr 2006 15:27:49 +1000

I'm about to test to see how well it works.
But here is my zmobie watching test objects. What do you think?

===== DebugObject.h =====
#import <Foundation/Foundation.h>

@interface DebugObject : NSObject {
+ (void) install;

@interface DeadObject : NSObject {
===== DebugObject.m ====
#import "DebugObject.h"

static NSMutableDictionary * whoWasIt = nil;

@implementation DebugObject

+ (void) install
[self poseAsClass: [NSObject class]];

NSLog(@"DebugObject now posing as NSObject, watch out, NO OTHER OBJECT WILL EVER BE RELEASED!");
- (void) dealloc
Class pClass = self->isa;
self->isa = [DeadObject class];

if( !whoWasIt )
 whoWasIt = [[NSMutableDictionary alloc] init];
[whoWasIt setObject: pClass forKey: self];


@implementation DeadObject

- (void) forwardInvocation: (NSInvocation*)anInvocation
Class pClass = [whoWasIt objectForKey: self];
NSLog(@"DeadObject %@ received message %@", pClass, anInvocation);


reply via email to

[Prev in Thread] Current Thread [Next in Thread]