diff --git a/ChangeLog b/ChangeLog index 2ff564142..b4ca89aea 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2006-03-31 Richard Frith-Macdonald + + * Source/Additions/GSObjCRuntime.m: Add a class for autoreleased + memory so it is clearer when using object allocation debugging. + 2006-03-28 Richard Frith-Macdonald * Source/GSString.m: Fix error initialising mutable string from diff --git a/Source/Additions/GSObjCRuntime.m b/Source/Additions/GSObjCRuntime.m index 7e6c693a9..1110309fb 100644 --- a/Source/Additions/GSObjCRuntime.m +++ b/Source/Additions/GSObjCRuntime.m @@ -2197,6 +2197,11 @@ NSArray *GSObjCDirectSubclassesOfClass(Class cls) } } +@interface GSAutoreleasedMemory : NSObject +@end +@implementation GSAutoreleasedMemory +@end + void * GSAutoreleasedBuffer(unsigned size) { @@ -2208,22 +2213,22 @@ GSAutoreleasedBuffer(unsigned size) #endif #define ALIGN __alignof__(double) - static Class nsobject_class = 0; + static Class buffer_class = 0; static Class autorelease_class; static SEL autorelease_sel; static IMP autorelease_imp; static int offset; NSObject *o; - if (nsobject_class == 0) + if (buffer_class == 0) { - nsobject_class = [NSObject class]; - offset = nsobject_class->instance_size % ALIGN; + buffer_class = [GSAutoreleasedMemory class]; + offset = buffer_class->instance_size % ALIGN; autorelease_class = [NSAutoreleasePool class]; autorelease_sel = @selector(addObject:); autorelease_imp = [autorelease_class methodForSelector: autorelease_sel]; } - o = (NSObject*)NSAllocateObject(nsobject_class, + o = (NSObject*)NSAllocateObject(buffer_class, size + offset, NSDefaultMallocZone()); (*autorelease_imp)(autorelease_class, autorelease_sel, o); return ((void*)&o[1]) + offset;