Problem with [NSStatusItem setTitle:]
Problem with [NSStatusItem setTitle:]
- Subject: Problem with [NSStatusItem setTitle:]
- From: Yonatan Feldman <email@hidden>
- Date: Wed, 17 Sep 2003 23:43:26 -0400
I am writing a status bar application that updates the title of the
status item at a regular interval, a la "menu bar clock". After
leaving my application running all night at a "fast interval" I
noticed that it grew dramatically in memory foot print. Using
OmniObjectMeter I was able to trace that more than 80% of the
memory was allocated to what that application categorizes as
"anonymous bytes". Of those "anonymous bytes" I was able to trace
about 95% of them to invocations of [NSStatusItem setTitle:]. Here
is a sample stack trace from OmniObjectMeter:
0x90009428 in _malloc_zone_calloc
0x91ee6524 in _NewPrivData
0x91ee86c4 in _CSyncColorDevice
0x91ee6870 in _CSyncAcquirePrivateData
0x91ee2114 in _CSyncSetDefaultPolicies
0x93730c40 in _CGSColorDeviceSetDefaultPolicies
0x91f516a8 in _ripc_InitializeDevice
0x91f56598 in ___CGWindowContextCreate
0x937311a0 in _CGWindowContextCreate
0x9311a7b0 in -[NSWindowGraphicsContext _initWithWindowNumber:]
0x930792f4 in -[NSWindow _threadContext]
0x930952b8 in -[NSWindow _postingDisabled]
0x93097c60 in -[NSWindow setViewsNeedDisplay:]
0x9308477c in -[NSView setNeedsDisplayInRect:]
0x93307cb0 in -[NSStatusItem(NSStatusItemCommon) setTitle:]
0x00003d30 in -[MyClass updateStatusItem:]
0x97e2cc50 in _forkThreadForFunction
0x90020c88 in __pthread_body
Not all stack traces are exactly the same but they are fairly similar
and all of the allocations are happening at different points under
[NSStatusItem setTitle:]
The last statement within my code is the call to [MyClass
updateStatusItem:]. The other objects listed as top offenders by
OmniObjectMeter are CGContext and NSWindowGraphicsContext.
I tested this further by removing all of my code from the loop that
updates the NSStatusItem title and just leaving the [NSStatusItem
setTitle:] call and passing it a static string as an argument. I was
able to determine that this did not make a difference, the problem
remained.
Has anyone else observed this behavior? Any suggested workarounds?
Thanks in advance,
yon.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.