#include #include #include #include @implementation PXObject + (instancetype)alloc { return class_createInstance(self, 0); } + (instancetype)allocDebug { printf("alloc: self = %p\n", (void*)self); printf("alloc: instance size = %zu\n", class_getInstanceSize(self)); printf("alloc: sizeof(Class) = %zu\n", sizeof(Class)); id object = [self alloc]; printf("alloc: object = %p\n", (void*)object); return object; } - (instancetype)init { return self; } - (void)dealloc { object_dispose(self); } @end