Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Does cocoa just leak?



This does fix the leak in the loop, but not if people wish to use convenience to [[NSFileManager defaultManager] fileExistsAtPath:[[instance URL] path]]

That is still going to leak I believe.

And why isn't all the strings released when awakeFromNib is over when an Auto release pool is not explicitly declared?

Ack, at 9/30/01, Fabrice Truillot said:

On Dimanche, septembre 30, 2001, at 05:37 , Rosyna wrote:

for (i=0;i<5000;i++)
[[instance URL] path];

You should take a look to NSAutoreleasePool.


Try something like that :

for (int i = 0; i < 100000; ++ i)
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];

[[instance URL] path];

[pool release];
}

Or :

NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];

for (int i = 0; i < 100000; ++ i)
{
[[instance URL] path];

if (i % 100)
{
[pool release];
pool = [[NSAutoreleasePool alloc] init];
}
}

--
Sincerely,
Rosyna Keller
Technical Support/Holy Knight/Always needs a hug

Unsanity: Unsane Tools for Insane People




Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.