I wonder if your memory issues are related to autorelease issues when using 
[NSDirectoryEnumerator nextObject:]

If you are using enumeratorAtPath, I suggest doing you loop like this (from 
http://www.cocoadev.com/index.pl?NSDirectoryEnumerator):

NSDirectoryEnumerator *enumerator  = [[NSFileManager defaultManager] 
enumeratorAtPath:  path];
NSAutoreleasePool *innerPool = [[NSAutoreleasePool alloc] init];
while ((curObject = [enumerator nextObject])) {
    // do stuff
    [innerPool release];
    innerPool = [[NSAutoreleasePool alloc] init];
}
[innerPool release];
innerPool = nil;

(Basically you need to ensure that the [enumerator nextObject] result doesn't 
end up in a higher-level autorelease pool as they will live for the duration of 
the entire scan

Matt

On 23 Feb 2011, at 06:08, Laurent Daudelin wrote:

> I need to write an application that will scan entire drives and compare files 
> between the 2 drives. I have already something working but in situations 
> where there are a lot of files (hundreds of thousands), the memory 
> consumption becomes a problem, leading to slow performance when virtual 
> memory is used and, ultimately, sometimes to crashes in malloc.
> 
> Of course, I could go with little chunks, comparing, but I need to present a 
> window showing which copies of files are more recent on one drive and which 
> ones are more recent on the other drive, so I need to keep a list of all the 
> files on one drive that are more recent than their counterparts on the other 
> drive, and vice versa. This preferably would have to be done in Cocoa, since 
> I already have a working solution.
> 
> Knowing that I have to support 10.5 but run under 10.6, what would be the 
> best way to have a crack at this problem?
> 
> All suggestions are welcome!
> 
> -Laurent.
> -- 
> Laurent Daudelin
> AIM/iChat/Skype:LaurentDaudelin                               
> http://www.nemesys-soft.com/
> Logiciels Nemesys Software                                            
> laur...@nemesys-soft.com
> 
> _______________________________________________
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/mgough%40humyo.com
> 
> This email sent to mgo...@humyo.com

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to