• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSAutoreleasePool: how does it really work?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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 12:20:34 +0100

Hi Oleg,
I tried both the samples you granted (MyLoop1 and MyLoop2), and they
produced the same lack of memory.

Before launching the routine I have:
PID COMMAND %CPU TIME #TH #PRTS #MREGS RPRVT RSHRD RSIZE VSIZE
1301 MyApp 0.0% 0:01.07 1 60 138 3.03M 7.39M 8.61M 105M


And after my routine ends I get:
PID COMMAND %CPU TIME #TH #PRTS #MREGS RPRVT RSHRD RSIZE VSIZE
1301 MyApp 0.0% 0:06.88 1 60 237 27.7M 7.41M 33.3M+ 130M

The RSIZE value remains at 33.3M and never goes down. Sure I don't do
anything else, either before and after the routine. I also tried to attach
this routine to the button directly as:

- (IBAction)MyLoop2:(id)sender
{
int i;
xArray = [NSMutableArray arrayWithCapacity:0];
for(i = 0; i < 500000; i++){
NSAutoreleasePool *myPool = [[NSAutoreleasePool alloc] init];
[xArray addObject:[NSString stringWithFormat:@"Do leak, step %d",
i]];
[myPool release];
}
[xArray removeAllObjects];
}

Any idea?


Best Regards
--
Lorenzo Puleo
email: email@hidden

> From: Oleg Svirgstin <email@hidden>
> Date: Tue, 18 Mar 2003 13:15:26 +0300
> To: <email@hidden>
> Cc: Lorenzo Puleo <email@hidden>
> Subject: Re: NSAutoreleasePool: how does it really work?
>
> I would suggest such experimental pair:
>
>> ===============================
>> - (void)MyLoop1
>> {
>> int i;
>> xArray = [NSMutableArray arrayWithCapacity:0];
>> for(i = 0; i < 500000; i++)
>> {
>> NSAutoreleasePool *myPool = [[NSAutoreleasePool alloc] init];
>> [xArray addObject:[NSString stringWithFormat:@"Do leak, step %d", i]];
>> [myPool release];
>> }
>> [xArray removeAllObjects];
>> }
>> ===============================
>
> against
>
>> ===============================
>> - (void)MyLoop2
>> {
>> int i;
>> xArray = [NSMutableArray arrayWithCapacity:0];
>> for(i = 0; i < 500000; i++){
>> [xArray addObject:[NSString stringWithFormat:@"Don\'t leak, step %d", i]];
>> }
>> [xArray removeAllObjects];
>> }
>> ===============================
>
> and then compare results. IMHO, they BOTH should not leak. :(
>
> Regards
> Oleg
_______________________________________________
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.

  • Follow-Ups:
    • Re: NSAutoreleasePool: how does it really work?
      • From: petite_abeille <email@hidden>
References: 
 >Re: NSAutoreleasePool: how does it really work? (From: Oleg Svirgstin <email@hidden>)

  • Prev by Date: Maybe a little off topic but important
  • Next by Date: Re: NSAutoreleasePool: how does it really work?
  • Previous by thread: Re: NSAutoreleasePool: how does it really work?
  • Next by thread: Re: NSAutoreleasePool: how does it really work?
  • Index(es):
    • Date
    • Thread