This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

C6727 堆溢出问题

Other Parts Discussed in Thread: TMS320C6727B

今天进行C6727调试时发现是堆溢出了,是在每秒周期进行矩阵求逆的时候,感觉上次malloc申请的堆的空间没有释放成功,重新申请新的堆空间,堆的空间占用越来越大,直到溢出了

问题是相同的程序在同一批电装的另外一块板子上运行的时候,没有问题,释放成功,堆空间占用一直较小,出现故障的板子上软件稍作修改,加几句无关的代码重新编译故障也消失了,求逆函数是封装的库函数,使用源代码运行,故障也消失了。请教这是什么原因。

heap 大小0x1000     封库时使用了-o3编译选项,函数代码如下

int brinv(double a[], int n)
{ int *is,*js,i,j,k,l,u,v;
double d,p;
is=malloc(n*sizeof(int)); // n的大小为6
js=malloc(n*sizeof(int)); // n的大小为6
    /***********
   求逆运算代码
 *************/   

free(is); free(js);
return(1);
}