Skip to content

Instantly share code, notes, and snippets.

@aufflick
Created January 14, 2010 01:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save aufflick/276770 to your computer and use it in GitHub Desktop.
Save aufflick/276770 to your computer and use it in GitHub Desktop.
@implementation CJTestCJCard
- (void)setUpClass {
// swap the release implementations
Method releaseMethod = class_getInstanceMethod([NSObject class],
@selector(release));
Method releaseLogMethod = class_getInstanceMethod([NSObject class],
@selector(releaseLog));
IMP origReleaseImp = method_setImplementation(releaseMethod,
method_getImplementation(releaseLogMethod));
method_setImplementation(releaseLogMethod, origReleaseImp);
// do the same for autorelease
Method autoreleaseMethod = class_getInstanceMethod([NSObject class],
@selector(autorelease));
Method autoreleaseLogMethod = class_getInstanceMethod([NSObject class],
@selector(autoreleaseLog));
IMP origAutoReleaseImp = method_setImplementation(autoreleaseMethod,
method_getImplementation(autoreleaseLogMethod));
method_setImplementation(autoreleaseLogMethod, origAutoReleaseImp);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment