discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: question about GNUstep memmory consumption


From: Helge Hess
Subject: Re: question about GNUstep memmory consumption
Date: Thu, 02 Nov 2000 19:27:18 +0100

Fredo wrote:
> 
> Hello,
> 
> I have written a basic test to evaluate GNUstep memory usage:
> 
>         int i = 0;
>         id pool = [NSAutoreleasePool new];
>         for ( i = 0; i < 100000; i++ )
>         {
>                 [NSNumber numberWithInt:i];
>         }
>         sleep( 10 );
>         [pool release];
> 
> The process size, in bytes, grow from 35127296 up to 43581440.
> This give an approximate size of 84 bytes / NSIntNumber (concrete class
> for int type).

More exactly: for an 'autoreleased' number.

> In the same time, the following code gives a size of 8 bytes /
> NSIntNumber.
> NSLog( @"sizeof(NSIntNumber:%i)\n", class_get_instance_size(
> [NSIntNumber class] ) );
> 
> I have two questions:
> 1. Is this correct?

I guess so.

> 2. what does eat the remaining memory?

At least a part is consumed by the registry of the NSAutoreleasePool
(all numbers you create are autoreleased ones which are added to
'pool').
I'm not sure how gstep-base maintains extra-retain-counts, but they
might also add overhead (eg if stored in an external hashtable) here.

Helge



reply via email to

[Prev in Thread] Current Thread [Next in Thread]