mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-31 00:30:53 +00:00
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:
parent
8af37de38b
commit
3efbfa42e2
17 changed files with 428 additions and 16 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue