diff --git a/SoObjects/SOGo/NSObject+Utilities.h b/SoObjects/SOGo/NSObject+Utilities.h index 469eab8b9..102ab7ef3 100644 --- a/SoObjects/SOGo/NSObject+Utilities.h +++ b/SoObjects/SOGo/NSObject+Utilities.h @@ -40,6 +40,8 @@ - (NSString *) labelForKey: (NSString *) key inContext: (WOContext *) context; ++ (void) memoryStatistics; + @end #endif /* NSOBJECT+UTILITIES_H */ diff --git a/SoObjects/SOGo/NSObject+Utilities.m b/SoObjects/SOGo/NSObject+Utilities.m index 2f9ed96cd..b85a7e528 100644 --- a/SoObjects/SOGo/NSObject+Utilities.m +++ b/SoObjects/SOGo/NSObject+Utilities.m @@ -22,6 +22,7 @@ #import #import +#import #import #import @@ -122,4 +123,30 @@ return label; } ++ (void) memoryStatistics +{ + Class *classList = GSDebugAllocationClassList (); + Class *pointer; + int i, count, total, peak; + NSString *className; + + pointer = classList; + i = 0; + + printf("Class count total peak\n"); + while (pointer[i] != NULL) + { + className = NSStringFromClass (pointer[i]); + count = GSDebugAllocationCount (pointer[i]); + total = GSDebugAllocationTotal (pointer[i]); + peak = GSDebugAllocationPeak (pointer[i]); + + printf("%s %d %d %d\n", [className UTF8String], count, total, peak); + i++; + } + NSZoneFree(NSDefaultMallocZone(), classList); + + printf("Done!\n"); +} + @end