Hi,
I use a LPC1778 with RTX and RL-TCP library. I am getting ERR_MEM_ALLOC error (sys_error()) after some tcp activity.
The pc send a request of 16 bytes and the card responds with a data frame of 112 bytes and this 10000 times in a row.
After several hundred sending the program crashes. Never in one place.
so I change the memory pool size :
#define MEM_SIZE 2045
by
#define MEM_SIZE 4096
My send function is :
void send_data_param (U8 *mesg, U16 nb) { U8 *sendbuf; if (tcp_get_state(socket_tcp_param) == TCP_STATE_CONNECT) if (tcp_check_send (socket_tcp_param) == __TRUE) { sendbuf = tcp_get_buf(nb); memcpy(sendbuf,mesg,nb); tcp_send(socket_tcp_param, sendbuf, nb); } }
how can I know the memory pool required?
Why the error persists then I doubled his memory pool?
The memory pool is automatically managed by RTX and TCPnet?
how can you know if the memory pool is full?
Anyone a suggestion how to solve this problem?
Thanks. JB
"Is there a list of functions from the TcpLib which are not thread safe?"
It's more a case of saying none are unless explicitly stated otherwise:
Functions are not reentrant. This means they must not be interrupted and called again from another task. All TCPnet-related functionality should be collected in a single networking task.
To be found at:
www.keil.com/.../rlarm_tn_using_withkernel.htm
DJR
Hi IB Shy,
I did a debug trace with a UlinkPro of my program.
it goes in the function tcp_get_buf(), and in this function, call it alloc_mem() and after sys_error(). I see no call for another task or interrupt.
I do not understand this error?
It isn't enough that you have one thread with locks - are you sure that not another thread (without locks) have already called any of the non-reentrant functions?