Improved memory usage reporting mechanisms

This commit is contained in:
Richard Frith-Macdonald 2019-08-08 17:20:25 +01:00
parent 2ca4f74af5
commit dd36855923
21 changed files with 404 additions and 230 deletions

View file

@ -814,26 +814,11 @@ const NSHashTableCallBacks NSPointerToStructHashCallBacks =
@implementation NSConcreteHashTable
+ (NSUInteger) contentSizeOf: (NSObject*)obj
declaredIn: (Class)cls
excluding: (NSHashTable*)exclude
- (NSUInteger) sizeOfContentExcluding: (NSHashTable*)exclude
{
GSIMapTable map = (GSIMapTable)obj;
NSUInteger size = GSIMapSize(map) - sizeof(GSIMapTable);
/* If we knew that this table held objects, we could return their size...
GSIMapEnumerator_t enumerator = GSIMapEnumeratorForMap(map);
GSIMapNode node = GSIMapEnumeratorNextNode(&enumerator);
while (node != 0)
{
size += [node->key.obj sizeInBytesExcluding: exclude];
node = GSIMapEnumeratorNextNode(&enumerator);
}
GSIMapEndEnumerator(&enumerator);
*/
return size;
/* Can't safely calculate for mutable object; just buffer size
*/
return nodeCount * sizeof(GSIMapNode);
}
+ (void) initialize