mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-05-01 01:39:30 +00:00
Added memory statistics - set SOGoDebugLeaks = YES and call [[self class] memoryStatistics]
This commit is contained in:
@@ -40,6 +40,8 @@
|
||||
- (NSString *) labelForKey: (NSString *) key
|
||||
inContext: (WOContext *) context;
|
||||
|
||||
+ (void) memoryStatistics;
|
||||
|
||||
@end
|
||||
|
||||
#endif /* NSOBJECT+UTILITIES_H */
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
|
||||
#import <Foundation/NSArray.h>
|
||||
#import <Foundation/NSBundle.h>
|
||||
#import <Foundation/NSDebug.h>
|
||||
#import <Foundation/NSEnumerator.h>
|
||||
#import <Foundation/NSString.h>
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user