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: Directory size function: problem with iteration



On Oct 28, 2005, at 3:59 PM, Laurence Harris wrote:
On 10/28/05 4:38 PM, Lawrence Sanbourne didst favor us with:


On Oct 27, 2005, at 6:11 PM, Eric Schlegel wrote:



On Oct 27, 2005, at 3:46 PM, Lawrence Sanbourne wrote:



The function now works great on the directories I originally tested it on,
but it fails when I try to get the directory size of other directories, such
as / or /Users/ls (my home directory). The error is errFSNotAFolder (-1407),
and it occurs when it is trying to recursively get the directory size for
the FSRefs it has stored in the CFMutableArray. I've looked at this for a
long time and can't find anything. If you get a spare moment, it would be
great if you could take a look and tell me what might be wrong. I haven't
been able to find anything in common with the files it fails on, but they
all appear at least one level deep in the recursion.




This is totally a WAG, but what happens if you close the iterator for the current level before processing subdirectories? Maybe there's a limit on the number of open iterators, and you're exceeding it.


Good idea, and certainly more memory-efficient, but the problem still occurs.


Since FSRefs are not a CFType, have you tried this with something other than
a CFArray? FWIW, a simple non-CF array would be more efficient (less memory
and faster access) for working with FSRefs. I use the STL's vector for this,
but any contiguous block of memory would do.

I'd like to avoid C++, so unfortunately the STL is out. I considered a simple C array, but decided that the pain of reallocating memory as it grows wouldn't be worth my trouble (or the computer's). Would you agree? Do you think it's worth it to make my own simple linked list struct?


Thanks,
Larry


_______________________________________________ Do not post admin requests to the list. They will be ignored. Carbon-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/carbon-dev/email@hidden

This email sent to email@hidden
References: 
 >Re: Directory size function: problem with iteration (From: Laurence Harris <email@hidden>)



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.