Hi
I am using NDK version 2.20.4.26 with SYS/BIOS version 6.34.2.18 on a C66x dsp.
I have adapted the NDK helloWorld example to implement TCP server. The server works fine the first time that an external TCP client connects to it. The client then closes the connection and opens a new connection. When the client closes that second connection the server gives an exception:
ti.sysbios.heaps.HeapMem: line 350: assertion failure: A_invalidFree: Invalid free
xdc.runtime.Error.raise: terminating execution
I would like some help to find the reason for that exception please.
Below is console output from my code that shows what is going on. The server daemon does a malloc to create a receive message buffer, which it passes to recv(). The buffer is free'd when the connection closes. As you can see, the free appears to succeed but it is interesting that the buffer is allocated at a different address the second time around.
[C66xx_0] QMSS successfully initialized
CPPI successfully initialized
PA successfully initialized
TCP/IP Stack 'Hello World!' Application
TCP/IP Stack 'Hello World!' Application
PASS successfully initialized
Ethernet subsystem successfully initialized
Ethernet eventId : 48 and vectId (Interrupt) : 7
Registration of the EMAC Successful, waiting for link up ..
Network Added: If-1:172.29.68.187
Allocated buffer: 0xC0C92B0
dtask_tcpip_server called
Message received (length: 400 bytes, type: 0)
[snip]
Connection closed
Freeing buffer: 0xC0C92B0
Closing socket
dtask_tcpip_server called
Allocated buffer: 0xC0C1AA0
Message received (length: 400 bytes, type: 0)
[snip]
Connection closed
Freeing buffer: 0xC0C1AA0
Closing socket
ti.sysbios.heaps.HeapMem: line 350: assertion failure: A_invalidFree: Invalid free
xdc.runtime.Error.raise: terminating execution
Any suggestions for how to fix the exception would be much appreciated.
David