Re: Busy doing nothing
Re: Busy doing nothing
- Subject: Re: Busy doing nothing
- From: "Gerriet M. Denkmann" <email@hidden>
- Date: Sat, 30 Aug 2008 00:47:44 +0700
On 29 Aug 2008, at 20:57, Phil wrote:
On Fri, Aug 29, 2008 at 9:42 PM, Gerriet M. Denkmann
<email@hidden> wrote:
If I add these magic lines it will use 0.2% of my Cpu just doing
nothing:
NSMetadataQuery *query = [ [ NSMetadataQuery alloc] init];
[ query startQuery ];
[ query stopQuery ];
NSArray *results = [ query results ]; //
_NSMetadataQueryResultArray
[ query release ];
From now on until quit I get every 100 msec one Context Switch
and two Mach
System Calls - as observed via Activity Monitor.
It's noted in the documentation that using -results is "not
recommended due to performance and memory issues".
My (Tiger) documentation says: "While it is possible to copy the
proxy array and receive a “snapshot” of the complete current query
results, it is generally not recommended due to performance and
memory issues."
(I had read this, but as I never copied the array, I thought it would
be ok.)
It continues: "you should instead use the resultCount and
resultAtIndex: methods."
Following this advice I succeeded in bringing the idle Cpu-time to 0%
in one app.
Thanks for pointing me in the right direction!
But the documentation also says: "The results array is a proxy object
that is primarily intended for use with Cocoa bindings."
And I have another app, where I never use "results" directly, but
which has an NSTableColumn bound via an NSArrayController to "results".
And this app also uses 0.2% Cpu while doing nothing.
Same behaviour in: /Developer/Examples/AppKit/Spotlighter.
Kind regards,
Gerriet.
_______________________________________________
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