« Return to Thread: Re: [Fire-commits] r4803 - branches/Fire-1-5-Update/fire/SpeechUtilities

Re: [Fire-commits] r4803 - branches/Fire-1-5-Update/fire/SpeechUtilities

by Graham Booker-2 :: Rate this Message:

| View in Thread

lastData is always NULL there, because it is freed in stopSpeaking.  
In answer to your question, no, there is no memory leak (at least  
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  
> memory leak now?
>
> Alan
> ______
> Alan Humpherys
> Fire Development Team
> alangh@...
> http://www.fireim.org
>
>
> On Jan 20, 2006, at 7:31 PM, gbooker@... 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  
>> crashes.
>>
>>
>> Modified: branches/Fire-1-5-Update/fire/SpeechUtilities/SUSpeaker.m
>> ===================================================================
>> --- branches/Fire-1-5-Update/fire/SpeechUtilities/SUSpeaker.m
>> 2006-01-21 02:24:41 UTC (rev 4802)
>> +++ branches/Fire-1-5-Update/fire/SpeechUtilities/SUSpeaker.m
>> 2006-01-21 02:31:19 UTC (rev 4803)
>> @@ -82,6 +82,7 @@
>>      _volume = 1 << 16;
>>
>>      NewSpeechChannel(NULL, &_speechChannel); // NULL voice is  
>> default voice
>> +    lastData = NULL;
>>      [self setCallbacks];
>>      return self;
>>  }
>> @@ -151,11 +152,11 @@
>>          //finished = NO;
>>          [self stopSpeaking];
>>          NSData *data = [text dataUsingEncoding:[NSString  
>> defaultCStringEncoding] allowLossyConversion:YES];
>> -        if(lastData != NULL)
>> -            free(lastData);
>> -        lastData = (void *)malloc([data length]);
>> +        int length = [data length];
>> +        lastData = (void *)malloc(length+1);
>>          [data getBytes:lastData];
>> -        SpeakText(_speechChannel, lastData, [data length]);
>> +        ((unsigned char *)lastData)[length] = '\0';
>> +        SpeakText(_speechChannel, lastData, length);
>>          //while(!finished);
>>          //sleep(2);
>>      }
>>
>>
>>
>> -------------------------------------------------------
>> This SF.net email is sponsored by: Splunk Inc. Do you grep through  
>> log files
>> for problems?  Stop!  Download the new AJAX search engine that makes
>> searching your log files as easy as surfing the  web.  DOWNLOAD  
>> SPLUNK!
>> http://sel.as-us.falkag.net/sel?cmd=lnk&kid3432&bid#0486&dat1642
>> _______________________________________________
>> Fire-commits mailing list
>> Fire-commits@...
>> https://lists.sourceforge.net/lists/listinfo/fire-commits
>
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc. Do you grep through  
> log files
> for problems?  Stop!  Download the new AJAX search engine that makes
> searching your log files as easy as surfing the  web.  DOWNLOAD  
> SPLUNK!
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid3432&bid#0486&dat1642
> _______________________________________________
> fire-development mailing list
> fire-development@...
> https://lists.sourceforge.net/lists/listinfo/fire-development
>



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid3432&bid#0486&dat1642
_______________________________________________
fire-development mailing list
fire-development@...
https://lists.sourceforge.net/lists/listinfo/fire-development

 « Return to Thread: Re: [Fire-commits] r4803 - branches/Fire-1-5-Update/fire/SpeechUtilities