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 (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