NSSpeechSynthesizer leaking
-
I just need a quick sanity check to make sure I'm not seeing
something obvious here before I submit this to Radar. Looks to me
that NSSpeechSynthesizer isn't cleaning up after itself properly.
Just a quick and simple action to that grabs some text from an
NSTextField. I subclassed NSSpeechSynthesizer
(DebugSpeechSynthesizer) so I could NSLog from retain, release, and
dealloc. DebugSpeechSynthesizer is getting dealloc'd, but there are
huge chunks of memory that are not being reclaimed (the main culprits
seem to live in MacinTalk AudioToolbox according to ObjectAlloc).
So anyway, am I missing something here? (for the record
DebugSpeechSynthesizer does call [super dealloc]). Clicking the speak
button repeatedly in my little sample app will consume hundreds of
megabytes of memory pretty quickly.
- (IBAction) speak: (id) inSender
{
NSSpeechSynthesizer *synthesizer =
[[DebugSpeechSynthesizer alloc] initWithVoice:
[NSSpeechSynthesizer defaultVoice]];
if (synthesizer != nil) {
[synthesizer setDelegate: self];
[synthesizer startSpeakingString: [_speechText stringValue]];
}
}
- (void) speechSynthesizer: (NSSpeechSynthesizer *) inSender
didFinishSpeaking: (BOOL) inFinishedSpeaking
{
NSLog(@"NSSpeechSynthesizer %@ finished", inSender);
[inSender release];
}
The demonstration app can be grabbed here if you like:
http://www.somegeekintn.com/download/SpeechTest.zip
Thanks for any insight,
Casey -
in speachSynthesizer:didFinishSpeaking: you are retaining the inSender
which seems wrong, and will cause a leak.
On Dec 20, 2005, at 11:10 AM, Casey Fleser wrote:> I just need a quick sanity check to make sure I'm not seeing
> something obvious here before I submit this to Radar. Looks to me
> that NSSpeechSynthesizer isn't cleaning up after itself properly.
>
> Just a quick and simple action to that grabs some text from an
> NSTextField. I subclassed NSSpeechSynthesizer
> (DebugSpeechSynthesizer) so I could NSLog from retain, release, and
> dealloc. DebugSpeechSynthesizer is getting dealloc'd, but there are
> huge chunks of memory that are not being reclaimed (the main
> culprits seem to live in MacinTalk AudioToolbox according to
> ObjectAlloc).
>
> So anyway, am I missing something here? (for the record
> DebugSpeechSynthesizer does call [super dealloc]). Clicking the
> speak button repeatedly in my little sample app will consume
> hundreds of megabytes of memory pretty quickly.
>
> - (IBAction) speak: (id) inSender
> {
> NSSpeechSynthesizer *synthesizer =
> [[DebugSpeechSynthesizer alloc] initWithVoice:
> [NSSpeechSynthesizer defaultVoice]];
>
> if (synthesizer != nil) {
> [synthesizer setDelegate: self];
> [synthesizer startSpeakingString: [_speechText stringValue]];
> }
> }
>
> - (void) speechSynthesizer: (NSSpeechSynthesizer *) inSender
> didFinishSpeaking: (BOOL) inFinishedSpeaking
> {
> NSLog(@"NSSpeechSynthesizer %@ finished", inSender);
>
> [inSender release];
> }
>
> The demonstration app can be grabbed here if you like:
>
> http://www.somegeekintn.com/download/SpeechTest.zip
>
> Thanks for any insight,
>
> Casey
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Cocoa-dev mailing list (<Cocoa-dev...>)
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/<demarco...>
>
> This email sent to <demarco...> -
Hmm? In speechSynthesizer: didFinishSpeaking: it says: [inSender
release].
BTW, I also tried creating an autoreleased version of
NSSpeechSynthesizer instead of releasing via the delegate message.
Either way though the NSSpeechSynthesizer will get dealloc'd, but not
clean up after itself properly.
I will probably work around this by creating a single
NSSpeechSynthesizer and reusing it as needed, but I shouldn't have to.
Casey
On Dec 20, 2005, at 1:13 PM, Vince DeMarco wrote:>
> in speachSynthesizer:didFinishSpeaking: you are retaining the inSender
>
> which seems wrong, and will cause a leak.
>
>
> On Dec 20, 2005, at 11:10 AM, Casey Fleser wrote:
>
>> I just need a quick sanity check to make sure I'm not seeing
>> something obvious here before I submit this to Radar. Looks to me
>> that NSSpeechSynthesizer isn't cleaning up after itself properly.
>>
>> Just a quick and simple action to that grabs some text from an
>> NSTextField. I subclassed NSSpeechSynthesizer
>> (DebugSpeechSynthesizer) so I could NSLog from retain, release,
>> and dealloc. DebugSpeechSynthesizer is getting dealloc'd, but
>> there are huge chunks of memory that are not being reclaimed (the
>> main culprits seem to live in MacinTalk AudioToolbox according to
>> ObjectAlloc).
>>
>> So anyway, am I missing something here? (for the record
>> DebugSpeechSynthesizer does call [super dealloc]). Clicking the
>> speak button repeatedly in my little sample app will consume
>> hundreds of megabytes of memory pretty quickly.
>>
>> - (IBAction) speak: (id) inSender
>> {
>> NSSpeechSynthesizer *synthesizer =
>> [[DebugSpeechSynthesizer alloc] initWithVoice:
>> [NSSpeechSynthesizer defaultVoice]];
>>
>> if (synthesizer != nil) {
>> [synthesizer setDelegate: self];
>> [synthesizer startSpeakingString: [_speechText stringValue]];
>> }
>> }
>>
>> - (void) speechSynthesizer: (NSSpeechSynthesizer *) inSender
>> didFinishSpeaking: (BOOL) inFinishedSpeaking
>> {
>> NSLog(@"NSSpeechSynthesizer %@ finished", inSender);
>>
>> [inSender release];
>> }
>>
>> The demonstration app can be grabbed here if you like:
>>
>> http://www.somegeekintn.com/download/SpeechTest.zip
>>
>> Thanks for any insight,
>>
>> Casey
>>
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Cocoa-dev mailing list (<Cocoa-dev...>)
>> Help/Unsubscribe/Update your Subscription:
>> http://lists.apple.com/mailman/options/cocoa-dev/<demarco...>
>>
>> This email sent to <demarco...>
>
> -
On Dec 20, 2005, at 1:39 PM, Casey Fleser wrote:> Hmm? In speechSynthesizer: didFinishSpeaking: it says: [inSender
> release].
>
> BTW, I also tried creating an autoreleased version of
> NSSpeechSynthesizer instead of releasing via the delegate message.
> Either way though the NSSpeechSynthesizer will get dealloc'd, but
> not clean up after itself properly.
>
> I will probably work around this by creating a single
> NSSpeechSynthesizer and reusing it as needed, but I shouldn't have to.
Using a singleton is what I do. It's definitely a bug though that
you should file.
___________________________________________________________
Ricky A. Sharp mailto:<rsharp...>
Instant Interactive(tm) http://www.instantinteractive.com -
On Dec 20, 2005, at 2:36 PM, Ricky Sharp wrote:>
> On Dec 20, 2005, at 1:39 PM, Casey Fleser wrote:
>
>> Hmm? In speechSynthesizer: didFinishSpeaking: it says: [inSender
>> release].
>>
>> BTW, I also tried creating an autoreleased version of
>> NSSpeechSynthesizer instead of releasing via the delegate message.
>> Either way though the NSSpeechSynthesizer will get dealloc'd, but
>> not clean up after itself properly.
>>
>> I will probably work around this by creating a single
>> NSSpeechSynthesizer and reusing it as needed, but I shouldn't have
>> to.
>
> Using a singleton is what I do. It's definitely a bug though that
> you should file.
>
Also use MallocDebug or leaks and include that in the bug report.
It probably is us.> ___________________________________________________________
> Ricky A. Sharp mailto:<rsharp...>
> Instant Interactive(tm) http://www.instantinteractive.com
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Cocoa-dev mailing list (<Cocoa-dev...>)
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/<demarco...>
>
> This email sent to <demarco...> -
On Dec 20, 2005, at 5:27 PM, Vince DeMarco wrote:>> On Dec 20, 2005, at 1:39 PM, Casey Fleser wrote:
>>
>>> Hmm? In speechSynthesizer: didFinishSpeaking: it says: [inSender
>>> release].
>>>
>>> BTW, I also tried creating an autoreleased version of
>>> NSSpeechSynthesizer instead of releasing via the delegate
>>> message. Either way though the NSSpeechSynthesizer will get
>>> dealloc'd, but not clean up after itself properly.
>>>
>>> I will probably work around this by creating a single
>>> NSSpeechSynthesizer and reusing it as needed, but I shouldn't
>>> have to.
>>
>> Using a singleton is what I do. It's definitely a bug though that
>> you should file.
>>
>
> Also use MallocDebug or leaks and include that in the bug report.
>
> It probably is us.
I filed it yesterday prior to this response, but if I have a moment
I'll go back and add whatever information MallocDebug can provide me
with.
Thanks,
Casey


