CCS5.5堆栈的问题?

环境:CCS5.5

DSP:TMS320C6748

基于SYSBIOS开发的程序,

code memory、data memory、stack memory全都放在了DDR中。

map文件如下:

MEMORY CONFIGURATION

         name            origin    length      used     unused   attr    fill
----------------------  --------  ---------  --------  --------  ----  --------
  IROM                  11700000   00100000  00000000  00100000  R  X
  L3_CBA_RAM            80000000   00020000  00000000  00020000  RW X
  DDR                   c0000000   08000000  000dd628  07f229d8  RW X

 

 

程序编译时一直有一个警告:

ti.sysbios.BIOS heapSize: BIOS.heapSize and Memory.defaultHeapInstance have both been set.  BIOS.heapSize ignored.  Using Memory.defaultHeapInstance.

根据警告信息路径是在.xdchelp文件中,但.xdchelp文件是一个大小为0的空文件。

程序大多数时候运行正常,但有时在debug时控制台Console中会出现如下错误然后终止:

TCP: Retransmit Timeout ti.sysbios.heaps.HeapMem: line 322: assertion failure: A_invalidFree: Invalid free xdc.runtime.Error.raise: terminating execution

 

请问是什么原因?如何解决?

 

ps:有人说是内存没有正确释放

查了一下,程序中有3个动态指针,但是malloc之后应当free了:

struct DATA1 *pdata1 = NULL;

struct DATA2 *pdata2 = NULL;

struct DATA3 *pdata3 = NULL;

pdata1 = (struct DATA1 *)malloc(sizeof(struct DATA1 )*N);

for(...)

{...}

if(a>10)

{

pdata2 = (struct DATA2 *)malloc(sizeof(struct DATA2 )*N);

...

free(pdata2);

}

free(pdata1);

...

pdata3 = (struct DATA3 *)malloc(sizeof(struct DATA3 )*N);

i=1;

if(i==1)

{i=2;}

else if(i==2)

{...

free(pdata3 );//i=2的条件肯定可以满足,因此pdata3一定可以正常free

}

else

{...}