Hi all,
I used Rational purify profiler to profile the sphinx3,the purify reported that:
in file src\libs3decoder\libam\ms_mgau.c
function ms_mgau_init(char meanfile,
char varfile, float64 varfloor,
char mixwfile, float64 mixwfloor,
int32 precomp, char senmgau, char *lambdafile, int32 _topn)
.
.
.
188 msg->mgau2sen =
189 (mgau2sen_t ) ckd_calloc(g->n_mgau, sizeof(mgau2sen_t ));
190 for (i = 0; i < s->n_sen; i++) {
191 m2s = (mgau2sen_t ) ckd_calloc(1, sizeof(mgau2sen_t));
192 m2s->sen = i;
193 m2s->next = msg->mgau2sen[s->mgau[i]];
194 msg->mgau2sen[s->mgau[i]] = m2s;
195 }
.
.
this part malloc a msg->mgau2sen with type mgau2sen_t ,and msg->mgau2sen points to a link list which is also created by malloc.
this function has no code about above init function code which I point,I changed the ms_mgau_free to
ms_mgau_free(ms_mgau_model_t * msg)
{
mgau2sen_t* p;
mgau2sen_t q ;
and In another file src\libs3decoder\libsearch\kb.c:
in function
void
kb_set_uttid(char _uttid, char _uttfile, kb_t * _kb)
{
assert(_kb != NULL);
assert(_uttid != NULL);
the purify said the _kb->uttid line has memory leakage,then I changed the function kb_free()
I added "ckd_free(kb->uttid);" at bottom of the function,is that the right way?and what about the _uttfile memory?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi all,
I used Rational purify profiler to profile the sphinx3,the purify reported that:
in file src\libs3decoder\libam\ms_mgau.c
function ms_mgau_init(char meanfile,
char varfile, float64 varfloor,
char mixwfile, float64 mixwfloor,
int32 precomp, char senmgau, char *lambdafile, int32 _topn)
.
.
.
188 msg->mgau2sen =
189 (mgau2sen_t ) ckd_calloc(g->n_mgau, sizeof(mgau2sen_t ));
190 for (i = 0; i < s->n_sen; i++) {
191 m2s = (mgau2sen_t ) ckd_calloc(1, sizeof(mgau2sen_t));
192 m2s->sen = i;
193 m2s->next = msg->mgau2sen[s->mgau[i]];
194 msg->mgau2sen[s->mgau[i]] = m2s;
195 }
.
.
this part malloc a msg->mgau2sen with type mgau2sen_t ,and msg->mgau2sen points to a link list which is also created by malloc.
BUT in the free function
226 void
227 ms_mgau_free(ms_mgau_model_t * msg)
228 {
229 if (msg == NULL)
230 return;
231
232 gauden_free(msg->g);
233 senone_free(msg->s);
234 ckd_free_3d((void *) msg->dist);
235 ckd_free(msg->mgau_active);
236 ckd_free(msg);
237 }
this function has no code about above init function code which I point,I changed the ms_mgau_free to
ms_mgau_free(ms_mgau_model_t * msg)
{
mgau2sen_t* p;
mgau2sen_t q ;
}
the memory leakage is not reported again.
and In another file src\libs3decoder\libsearch\kb.c:
in function
void
kb_set_uttid(char _uttid, char _uttfile, kb_t * _kb)
{
assert(_kb != NULL);
assert(_uttid != NULL);
}
the purify said the _kb->uttid line has memory leakage,then I changed the function kb_free()
I added "ckd_free(kb->uttid);" at bottom of the function,is that the right way?and what about the _uttfile memory?