mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-23 21:52:13 +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
1ab490d19a
commit
841ddf78e0
17 changed files with 428 additions and 16 deletions
|
@ -393,4 +393,30 @@ static GC_descr nodeDesc; // Type descriptor for map node.
|
|||
return GSIMapCountByEnumeratingWithStateObjectsCount
|
||||
(&map, state, stackbuf, len);
|
||||
}
|
||||
|
||||
- (NSUInteger) sizeInBytes: (NSHashTable*)exclude
|
||||
{
|
||||
NSUInteger size = GSPrivateMemorySize(self, exclude);
|
||||
|
||||
if (size > 0)
|
||||
{
|
||||
NSUInteger count = [self count];
|
||||
|
||||
size += GSIMapSize(&map) - sizeof(map);
|
||||
if (count > 0)
|
||||
{
|
||||
NSAutoreleasePool *pool = [NSAutoreleasePool new];
|
||||
NSEnumerator *enumerator = [self keyEnumerator];
|
||||
NSObject *k;
|
||||
|
||||
while ((k = [enumerator nextObject]) != nil)
|
||||
{
|
||||
size += [k sizeInBytes: exclude];
|
||||
}
|
||||
[pool release];
|
||||
}
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue