Re: NSSpeechSynthesizer leaks memory
Re: NSSpeechSynthesizer leaks memory
- Subject: Re: NSSpeechSynthesizer leaks memory
- From: Charlie Dickman <email@hidden>
- Date: Fri, 03 Aug 2012 18:46:04 -0400
After switching over to the Carbon API I have found that the memory leak is in it as well.On Aug 2, 2012, at 4:43 PM, Charlie Dickman wrote: According to a number of boards/blogs/sites on the www a significant memory leak exists in the NSSpeachSynthesizer class and has been there for quite a while. Apple has not addressed it in a number of system releases including Lion.
I'm going to try the Carbon API to work around this problem. On Aug 1, 2012, at 10:47 PM, Charlie Dickman wrote: My app uses an NSSpeechSynthesizer. After about 525-550 uses the app crashes unable to malloc memory deep in the synthesizer code. I have isolated the app so that the synthesizer can be avoided and have run it both with the synthesizer and without where the use of the synthesizer is the only difference. The code is quite simple...
- (void) say: (NSString *) phrase caller: (char *) caller { speakerIsSpeaking = YES; [speaker startSpeakingString: phrase]; while ([speaker isSpeaking]) RELQ(.1); }
speakerIsSpeaking is a file static flag that gets changed using the following delegate method...
static BOOL speakerIsSpeaking = NO;
- (void) speechSynthesizer: (NSSpeechSynthesizer *) sender didFinishSpeaking: (BOOL) success { if (success) speakerIsSpeaking = NO; }
RELQ looks like this...
#define RELQ(t) [NSApp nextEventMatchingMask: NSAnyEventMask \ untilDate: [NSDate dateWithTimeIntervalSinceNow: t != 0. ? t * 1.01 : .01] \ inMode: NSDefaultRunLoopMode \ dequeue: YES]
When run with the say method disabled all is well. When run with the say method enabled it crashes. the phrase argument is autoreleased. Can someone tell me where the memory is going and what I can do about it?
Charlie Dickman
Charlie Dickman
|
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden