• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSSpeechSynthesizer leaks memory
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
email@hidden


Charlie Dickman
email@hidden


Charlie Dickman
email@hidden



 _______________________________________________
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

References: 
 >NSSpeechSynthesizer leaks memory (From: Charlie Dickman <email@hidden>)
 >Re: NSSpeechSynthesizer leaks memory (From: Charlie Dickman <email@hidden>)

  • Prev by Date: Re: Keep output in the console
  • Next by Date: Re: How might I filter documentation being searched?
  • Previous by thread: Re: NSSpeechSynthesizer leaks memory
  • Next by thread: Re: NSSpeechSynthesizer leaks memory
  • Index(es):
    • Date
    • Thread