Re: NSAutoreleasePool: how does it really work?
Re: NSAutoreleasePool: how does it really work?
- Subject: Re: NSAutoreleasePool: how does it really work?
- From: Lorenzo Puleo <email@hidden>
- Date: Tue, 18 Mar 2003 16:35:35 +0100
Hi Phill,
Thank you for your detailed reply. You gave me fine informations.
I think Rsize means Real Size an application is using. More than this I can
see the Free Memory decreases while the Rsize increases. Look here belowe
the free memory is 328M before running the routine and 302M at the end.
Before running the routine
===========================
Processes: 43 total, 2 running, 41 sleeping... 103 threads
16:11:18
Load Avg: 0.56, 0.40, 0.34 CPU usage: 52.6% user, 17.5% sys, 29.8% idl
SharedLibs: num = 90, resident = 20.5M code, 2.61M data, 7.36M LinkEdit
MemRegions: num = 2392, resident = 16.8M + 8.26M private, 35.2M shared
PhysMem: 46.9M wired, 56.5M active, 81.1M inactive, 184M used, 328M free
VM: 2.00G + 51.8M 5047(1) pageins, 0(0) pageouts
PID COMMAND %CPU TIME #TH #PRTS #MREGS RPRVT RSHRD RSIZE VSIZE
409 MyApp 0.0% 0:00.99 1 60 130 3.00M 7.04M 8.57M 105M
After running the routine
===========================
Processes: 43 total, 2 running, 41 sleeping... 104 threads
16:11:50
Load Avg: 0.25, 0.35, 0.31 CPU usage: 2.9% user, 3.8% sys, 93.3% idle
SharedLibs: num = 90, resident = 20.7M code, 2.61M data, 7.36M LinkEdit
MemRegions: num = 2512, resident = 41.7M + 8.26M private, 35.5M shared
PhysMem: 47.1M wired, 56.9M active, 106M inactive, 210M used, 302M free
VM: 2.03G + 51.8M 5109(0) pageins, 0(0) pageouts
PID COMMAND %CPU TIME #TH #PRTS #MREGS RPRVT RSHRD RSIZE VSIZE
409 MyApp 0.0% 0:05.77 1 60 229 27.7M 7.14M 33.2M 130M
This time I used the following code:
===========================
- (IBAction)MyLoop:(id)sender
{
int i;
xArray = [NSMutableArray array];
for ( i = 0; i < 500000; i++ )
{
NSAutoreleasePool *myPool = [[NSAutoreleasePool alloc] init];
[xArray addObject:[NSString stringWithFormat: @"Don't leak, step
%d", i]];
[myPool release];
}
[xArray removeAllObjects];
return;
}
Sincerely I am afraid that I am doing something wrong.
If I run the loop for a bigger number of steps (100,000,000)
I see the free memory goes near zero, then the numbers of pageouts
increases. And at the end of the routine, my application keeps the CPU busy
for so long time because it has to clean the files used by the virtual
memory. And however the Rsize and the Free Mem don't come back to the
initial values.
Best Regards
--
Lorenzo Puleo
email: email@hidden
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.