|Home » Learning Curve » Developers Workshop
It Wasn't Good Then, It's No Better Now
NSOutlineView is of limited use and in some circumstances can cause fatal errors.
Try this as an experiment.
- Open either Finder or Path Finder (or both) and make sure you're in the 'list mode' - the one with the disclosure triangles to the left of the file items.
- Option-click on /System. Then hold on for dear life. Path Finder understands a bit of what's going on - it will automatically stop things after a few levels are expanded. (The option-click - or option-right arrow with a selection - is an 'expand all' command.) Back to Path Finder in a minute.
- The poor asthmatic Finder will just keep on expanding (at least on 10.5). This can go on seemingly forever. (10.5's /System has over 90,000 items; 10.6's /System has over 100,000.)
|$ sudo find /System | wc |
91119 106166 9421193
|$ sudo find /System | wc|
109817 127897 11299496
- The best thing to do for TFF is to kill it - and to remember to never ever thereafter click the wrong disclosure triangle again.
- Path Finder is a bit different - it stops the expansion after two levels. It can do this by responding to NSOutlineView's delegate method outlineView:shouldExpandItem:. It takes a lot of crunching - especially when you're supposed to be expanding as fast as you can - but it saves the day. At least temporarily.
- The coup de grãce comes when the sorry thing (Path Finder now, not Finder) is finally finished expanding all 90,000-100,000 items to its two levels. You only need a few columns of data open on the right for this to be sufficient. Go to the lower right corner and click that wee innocent button to 'refresh'.
- Kill Path Finder when you get tired of the exercise and/or when your laptop starts burning through your clothes and your Core 2 Duo starts melting your mobo.
Here are some pictures of what Activity Monitor would find. (Note there's a really stupid bug in Activity Monitor going back several years. This only makes the whole thing even more ludicrous.)
1. Watching Finder Melt
The situation gets so out of control that Apple's Activity Monitor repeatedly reports over 100% CPU usage. And keep an eye on the histograms in the lower right - and note how usage of real and virtual memory goes ballistic. (Usage of real memory almost doubles.)
2. Watching Path Finder Melt
Path Finder doesn't get off the hook - it's on the lookout for what should be innocuous expansions of an NSOutlineView - meaning you have a lot of work to do if you really want to drill down inside /System - but it gets whacked when it's time to refresh - an option Finder studiously does not allow.
So What's Wrong?
In both cases - both Finder and its mutant friend Path Finder - the NSOutlineView represents an Achilles heel. This is not a bug and there is no workaround. It's the design itself that's flawed - and not of NSOutlineView itself but in the choice of this control for file management.
What would happen to these sorry apps - and your Mac - if you were working from root ('/') instead?
Xfile Test Drive