Re: NSDirectoryEnumerator and URLs
Re: NSDirectoryEnumerator and URLs
- Subject: Re: NSDirectoryEnumerator and URLs
- From: Quincey Morris <email@hidden>
- Date: Wed, 13 Jan 2010 13:35:47 -0800
On Jan 13, 2010, at 10:32, Jamie Hardt wrote:
> I'm using a directory enumerator to recurse through a series of directories, and it always fails after going through a certain number of enumerations. If I enumerate through the same directory over and over, it tends to fail in about the same place, but if I enumerate through other directories, it will fail but after completing a different number of enumerations, so I don't think it's necessarily a memory thing or something wrong with my file system.
On the contrary, that behavior sounds *exactly* like a memory thing, or at least like a memory management problem.
I notice that you don't take ownership of (retain) the NSDirectoryEnumerator object. There's no obvious reason why it should disappear before the next "regular" draining of its autorelease pool, but perhaps something is triggering an early draining.
Also, if there happened to be any memory management bugs in the NSDirectoryEnumerator class itself, code like yours (using a subsidiary autorelease pool, in which any autoreleased memory allocated by the enumerator during the enumeration would be placed) would expose it.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden