NSSpeechSynthesizer leaks memory
NSSpeechSynthesizer leaks memory
- Subject: NSSpeechSynthesizer leaks memory
- From: Charlie Dickman <email@hidden>
- Date: Wed, 01 Aug 2012 22:47:43 -0400
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?
|
_______________________________________________
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