memory usage interrogation

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@38799 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
rfm 2015-07-15 14:14:21 +00:00
parent 8af37de38b
commit 3efbfa42e2
17 changed files with 428 additions and 16 deletions

View file

@ -41,6 +41,7 @@
#import "Foundation/NSAutoreleasePool.h"
#import "Foundation/NSArray.h"
#import "Foundation/NSException.h"
#import "Foundation/NSHashTable.h"
#import "Foundation/NSPortCoder.h"
#import "Foundation/NSDistantObject.h"
#import "Foundation/NSThread.h"
@ -2607,3 +2608,24 @@ static id gs_weak_load(id obj)
}
@end
NSUInteger
GSPrivateMemorySize(NSObject *self, NSHashTable *exclude)
{
if (0 == NSHashGet(exclude, self))
{
NSHashInsert(exclude, self);
return class_getInstanceSize(object_getClass(self));
}
return 0;
}
@implementation NSObject (MemorySize)
+ (NSUInteger) sizeInBytes: (NSHashTable*)exclude
{
return 0;
}
- (NSUInteger) sizeInBytes: (NSHashTable*)exclude
{
return GSPrivateMemorySize(self, exclude);
}
@end