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.

RTOS/TDA2P-ACD: Invalid Free error after calling Utils_memFree()

Part Number: TDA2P-ACD
Other Parts Discussed in Thread: SYSBIOS

Tool/software: TI-RTOS

Hello,

I am working with PSDK3.5 on TDA2Px-EVM. I have ported my algorithm code (originally developed on Windows platform) on DSP1 core of TDA2P. Below is my usecase,

"""""""""""""

NetworkRx (A15) -> Decode -> VPE -> Sync -> Alg_A (DSP1) -> Display_Video

"""""""""""""

In my algorithm code, I have done some memory allocations (Approx. 5-6 pointers) using below API, 

"""""""""""""

pObj->st = Utils_memAlloc (UTILS_HEAPID_DDR_CACHED_LOCAL,(MAX_IMAGE_HEIGHT * MAX_IMAGE_WIDTH  * sizeof(UInt8)), 32);

UTILS_assert(pObj->st != NULL);

"""""""""""""

And I am de-allocating memory at the end using below API,

"""""""""""""

status = Utils_memFree(UTILS_HEAPID_DDR_CACHED_LOCAL, pObj->st,
                           (MAX_IMAGE_WIDTH * MAX_IMAGE_HEIGHT * sizeof(UInt8)));
UTILS_assert(status == SYSTEM_LINK_STATUS_SOK);

"""""""""""""

As soon as I executing "Utils_memFree", I get below error,

[DSP1  ]    141.708534 s:  ### XDC ASSERT - ERROR CALLBACK START ###
[DSP1  ]    141.708564 s:
[DSP1  ]    141.708595 s: assertion failure: A_invalidFree: Invalid free
[DSP1  ]    141.708625 s:
[DSP1  ]    141.708656 s:  ### XDC ASSERT - ERROR CALLBACK END ###
[DSP1  ]    141.708686 s:
[DSP1  ]    141.708747 s: ti.sysbios.heaps.HeapMem: line 428: ti.sysbios.heaps.HeapMem: line 428:                   assertion failure: A_invalidFree: e
[DSP1  ]    141.708808 s: xdc.runtime.Error.raise: terminating execution

I dont get this error when "Utils_memFree" is executed for first two times. The third time it throws the above error. I thought I might have given wrong size while freeing the memory but that is not the case.

Can anyone give some suggestions on resolving this.

Regards,

Abhay