From: Graham B. <gb...@us...> - 2006-01-21 05:43:11
|
lastData is always NULL there, because it is freed in stopSpeaking. =20 In answer to your question, no, there is no memory leak (at least =20 there shouldn't be). - Graham Fire Development Team http://fire.sf.net On Jan 20, 2006, at 11:28 PM, Alan Humpherys wrote: > Graham, > > Since you no longer do a free on lastData, does this mean we have a =20= > memory leak now? > > Alan > ______ > Alan Humpherys > Fire Development Team > al...@us... > http://www.fireim.org > > > On Jan 20, 2006, at 7:31 PM, gb...@us... wrote: > >> Author: gbooker >> Date: 2006-01-21 15:31:19 +1300 (Sat, 21 Jan 2006) >> New Revision: 4803 >> >> Modified: >> branches/Fire-1-5-Update/fire/SpeechUtilities/SUSpeaker.m >> Log: >> Alan and I seem to think that this is the final fix for the Speech =20= >> crashes. >> >> >> Modified: branches/Fire-1-5-Update/fire/SpeechUtilities/SUSpeaker.m >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> --- branches/Fire-1-5-Update/fire/SpeechUtilities/SUSpeaker.m =20= >> 2006-01-21 02:24:41 UTC (rev 4802) >> +++ branches/Fire-1-5-Update/fire/SpeechUtilities/SUSpeaker.m =20= >> 2006-01-21 02:31:19 UTC (rev 4803) >> @@ -82,6 +82,7 @@ >> _volume =3D 1 << 16; >> >> NewSpeechChannel(NULL, &_speechChannel); // NULL voice is =20 >> default voice >> + lastData =3D NULL; >> [self setCallbacks]; >> return self; >> } >> @@ -151,11 +152,11 @@ >> //finished =3D NO; >> [self stopSpeaking]; >> NSData *data =3D [text dataUsingEncoding:[NSString =20 >> defaultCStringEncoding] allowLossyConversion:YES]; >> - if(lastData !=3D NULL) >> - free(lastData); >> - lastData =3D (void *)malloc([data length]); >> + int length =3D [data length]; >> + lastData =3D (void *)malloc(length+1); >> [data getBytes:lastData]; >> - SpeakText(_speechChannel, lastData, [data length]); >> + ((unsigned char *)lastData)[length] =3D '\0'; >> + SpeakText(_speechChannel, lastData, length); >> //while(!finished); >> //sleep(2); >> } >> >> >> >> ------------------------------------------------------- >> This SF.net email is sponsored by: Splunk Inc. Do you grep through =20= >> log files >> for problems? Stop! Download the new AJAX search engine that makes >> searching your log files as easy as surfing the web. DOWNLOAD =20 >> SPLUNK! >> http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=103432&bid#0486&dat=12164= 2 >> _______________________________________________ >> Fire-commits mailing list >> Fir...@li... >> https://lists.sourceforge.net/lists/listinfo/fire-commits > > > > ------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. Do you grep through =20 > log files > for problems? Stop! Download the new AJAX search engine that makes > searching your log files as easy as surfing the web. DOWNLOAD =20 > SPLUNK! > http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=103432&bid#0486&dat=121642= > _______________________________________________ > fire-development mailing list > fir...@li... > https://lists.sourceforge.net/lists/listinfo/fire-development > |