Skip navigation.
 
mlRe: How to track down this memory problem?
FROM : Adam Knight
DATE : Sat Jul 22 18:34:43 2006

In two different functions:

From a menu:
   [noteController setSelectionIndex:[sender tag]]
From a toolbar button or key combo:
   [noteController selectNext:sender]

Or, just to be annoying, when I click on the row in the table view, 
thus initiating a bindings-only change of content. :\

I'd thought it was my code for the longest time, until I realized I 
wasn't making an NSColor -- anywhere -- and that it only happened on 
pages from a few particular sites (notably, CSS-heavy web logs and 
similar).

I'll get a small test case up today, though.

--
Adam Knight
"Every man is guilty of all the good he didn't do."  -- Voltaire



On Jul 22, 2006, at 1:41 AM, Michael Watson wrote:

> Without seeing your code, it sounds supiciously like you're over-
> releasing an object somewhere.
>
> Can you show us the line it crashes on, with the rest of the method 
> around it?
>
>
> --
> Michael Watson
>
> On 22 Jul, 2006, at 02:06, Adam Knight wrote:
>

>> I have a very frustrating little bug I'm trying to find, and I'm 
>> almost certain it's Apple's and not mine, but I'm trying to make 
>> sure.
>>
>> My program (Notae) uses Cocoa classes to download a web page and 
>> render it as an attributed string, for one of its features.  This 
>> works.  However, certain sites cause problems in that when you 
>> switch to the note that has that data the program will crash. 
>> Reliably.  With the same backtrace.  In Apple's code.
>>
>> I've commented all my observing code out, all my major functions, 
>> disabled all features, etc. and the bug stands no matter how much 
>> I remove.  It's reduced sometimes, but never eliminated.  The only 
>> way to eliminate it is to not display those specific notes (return 
>> dummy values from the model).  After all I've looked into, it 
>> appears an NSColor instance, created by the RTF code, is released 
>> early right as the NSText object is performing a setTextColor: 
>> with it, and then blammo, it goes down.
>>
>> I do not have any code that does anything with the data before or 
>> during initial presentation, so that's out, too.
>>
>> So, good readers, any tips on finding this, fixing this, or 
>> writing up a really nice bug for Apple?
>>
>>
>>
>> Addl. Data:
>>
>> I did a malloc history on the missing instance and came up with 
>> the malloc, but not the free:
>>
>> Call [2] [arg=24]: thread_a000cf60 |0x1 | start | start | main | 
>> NSApplicationMain | -[NSApplication run] | -[NSApplication 
>> sendEvent:] | -[NSApplication _handleKeyEquivalent:] | -[NSMenu 
>> performKeyEquivalent:] | -[NSCarbonMenuImpl 
>> performActionWithHighlightingForItemAtIndex:] | -[NSMenu 
>> performActionForItemAtIndex:] | -[NSApplication 
>> sendAction:to:from:] | -[NoteDocument menuSelectNote:] | -
>> [NSArrayController setSelectionIndexes:] | -[NSArrayController 
>> _selectObjectsAtIndexesNoCopy:avoidsEmptySelection:sendObserverNotifi
>> cations:forceUpdate:] | -[NSArrayController 
>> didChangeValuesForArrangedKeys:objectKeys:indexKeys:] | -
>> [NSController didChangeValueForKey:] | -[NSController 
>> _notifyObserversForKeyPath:change:] | -[NSObject
>> (NSKeyValueObservingPrivate) _notifyObserversForKeyPath:change:] | 
>> -[NSTextValueBinder _observeValueForKeyPath:ofObject:context:] | -
>> [NSValueBinder _observeValueForKeyPath:ofObject:context:] | -
>> [NSValueBinder 
>> _adjustObject:mode:observedController:observedKeyPath:context:editabl
>> eState:adjustState:] | -[NSValueBinder showValue:inObject:] | -
>> [_NSTextPlugin showValue:inObject:] | -[NSAttributedString
>> (NSAttributedStringKitAdditions) initWithRTFD:documentAttributes:] 
>> | -[NSAttributedString(NSAttributedStringKitAdditions) 
>> initWithData:options:documentAttributes:error:] | 
>> _NSReadAttributedStringFromURLOrData | -[NSRTFReader 
>> attributedString] | CharAttr | processColor | +[NSColor 
>> colorWithCalibratedRed:green:blue:alpha:] | NSAllocateObject | 
>> _internal_class_createInstanceFromZone | malloc_zone_calloc
>>
>> And the backtrace is always something like:
>>
>> Exception:  EXC_BAD_ACCESS (0x0001)
>> Codes:      KERN_INVALID_ADDRESS (0x0001) at 0xdc38a535
>>
>> Thread 0 Crashed:
>> 0  <<00000000>>     0xfffeff20 objc_msgSend_rtp + 32
>> 1  com.apple.CoreFoundation           0x907cf99c 
>> CFDictionarySetValue + 448
>> 2  com.apple.Foundation               0x929134a4 -[NSCFDictionary
>> setObject:forKey:] + 184
>> 3  com.apple.AppKit                   0x9379bb68 -[NSTextView
>> (NSPrivate)
>> _addToTypingAttributes:value:] + 128
>> 4  com.apple.AppKit                   0x937a607c -[NSTextView 
>> setTextColor:]
>> + 316
>> 5  com.apple.AppKit                   0x93baa904 -[_NSTextPlugin
>> showValue:inObject:] + 372
>> 6  com.apple.AppKit                   0x9390598c -[NSValueBinder
>> showValue:inObject:] + 252
>> 7  com.apple.AppKit                   0x93904b30 -[NSValueBinder
>> _adjustObject:mode:observedController:observedKeyPath:context:editabl
>> eState:adjustState:]
>> + 892
>> 8  com.apple.AppKit                   0x9390473c -[NSValueBinder
>> _observeValueForKeyPath:ofObject:context:] + 264
>> 9  com.apple.AppKit                   0x93ba78cc -[NSTextValueBinder
>> _observeValueForKeyPath:ofObject:context:] + 60
>> 10  com.apple.Foundation               0x929b8d08
>> -[NSObject(NSKeyValueObservingPrivate) 
>> _notifyObserversForKeyPath:change:]
>> + 892
>> 11  com.apple.AppKit                   0x9392d3b0 -[NSController
>> _notifyObserversForKeyPath:change:] + 236
>>
>> Help?
>> --
>> Adam Knight
>> "Every man is guilty of all the good he didn't do."  -- Voltaire
>>
>>
>>
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Cocoa-dev mailing list      (<email_removed>)
>> Help/Unsubscribe/Update your Subscription:
>> http://lists.apple.com/mailman/options/cocoa-dev/mikey-san%
>> 40bungie.org
>>
>> This email sent to <email_removed>

>
>

Related mailsAuthorDate
mlHow to track down this memory problem? Adam Knight Jul 22, 08:06
mlRe: How to track down this memory problem? Michael Watson Jul 22, 08:41
mlRe: How to track down this memory problem? Andy Lee Jul 22, 09:58
mlRe: How to track down this memory problem? Nir Soffer Jul 22, 14:33
mlRe: How to track down this memory problem? Adam Knight Jul 22, 18:34
mlRe: How to track down this memory problem? Adam Knight Jul 22, 18:37
mlRe: How to track down this memory problem? Adam Knight Jul 22, 21:05