mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 08:21:25 +00:00
improve reportingn of memory usage
This commit is contained in:
parent
42b404c586
commit
3f7d54a33f
18 changed files with 395 additions and 267 deletions
|
@ -509,6 +509,13 @@ failure:
|
|||
*/
|
||||
@implementation NSData
|
||||
|
||||
+ (NSUInteger) contentSizeOf: (NSObject*)obj
|
||||
declaredIn: (Class)cls
|
||||
excluding: (NSHashTable*)exclude
|
||||
{
|
||||
return [(NSData*)obj length];
|
||||
}
|
||||
|
||||
+ (void) initialize
|
||||
{
|
||||
if (self == [NSData class])
|
||||
|
@ -2012,17 +2019,6 @@ failure:
|
|||
return NO;
|
||||
}
|
||||
|
||||
- (NSUInteger) sizeInBytesExcluding: (NSHashTable*)exclude
|
||||
{
|
||||
NSUInteger size = [super sizeInBytesExcluding: exclude];
|
||||
|
||||
if (size > 0)
|
||||
{
|
||||
size += [self length];
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
/**
|
||||
|
@ -2146,6 +2142,13 @@ failure:
|
|||
}
|
||||
}
|
||||
|
||||
+ (NSUInteger) contentSizeOf: (NSObject*)obj
|
||||
declaredIn: (Class)cls
|
||||
excluding: (NSHashTable*)exclude
|
||||
{
|
||||
return [(NSMutableData*)obj capacity];
|
||||
}
|
||||
|
||||
+ (id) data
|
||||
{
|
||||
NSMutableData *d;
|
||||
|
@ -3325,13 +3328,6 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
|
|||
}
|
||||
}
|
||||
|
||||
- (NSUInteger) sizeInBytesExcluding: (NSHashTable*)exclude
|
||||
{
|
||||
NSUInteger size = GSPrivateMemorySize(self, exclude);
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
|
@ -3408,17 +3404,6 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
|
|||
return self;
|
||||
}
|
||||
|
||||
- (NSUInteger) sizeInBytesExcluding: (NSHashTable*)exclude
|
||||
{
|
||||
NSUInteger size = GSPrivateMemorySize(self, exclude);
|
||||
|
||||
if (size > 0)
|
||||
{
|
||||
size += length;
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation NSDataWithDeallocatorBlock
|
||||
|
@ -4268,17 +4253,6 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
|
|||
length = size;
|
||||
}
|
||||
|
||||
- (NSUInteger) sizeInBytesExcluding: (NSHashTable*)exclude
|
||||
{
|
||||
NSUInteger size = GSPrivateMemorySize(self, exclude);
|
||||
|
||||
if (size > 0)
|
||||
{
|
||||
size += capacity;
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation NSMutableDataWithDeallocatorBlock
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue