This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

ERR_MEM_ALLOC

Hi,

I am using RL-TCP library in my LPC2148 with RTL8019 as a ethernet controller. I am getting ERR_MEM_ALLOC error after some tcp activity.

I have MEM_SIZE: Memory Pool size in bytes = 16384 in my config wizard.

Can anybody help me why i am getting this system error ?

Thanks

Parents
  • Thanks for reply !!

    but error does not come when I unplugged LAN cable, it is something related to tcp only.

    secondly I am not sending data over tcp more than 256 bytes, the code is

    unsigned char GUC_tcp_sck_h;
    unsigned char GUCA_TCP_Tx_Data[256];
    .
    .
    .
    .
    // socket creating & connection establishing
    .
    .
    //assigning some data to buffer GUCA_TCP_Tx_Data
    .
    
    void Transmit_Data(unsigned short length)
    {
        unsigned char * sendbuf;
        sendbuf = tcp_get_buf (length);
        memcpy (sendbuf, GUCA_TCP_Tx_Data, length);
    
        tcp_send (GUC_tcp_sck_h, sendbuf, length);
    }
    

    is something wrong in code ?

Reply
  • Thanks for reply !!

    but error does not come when I unplugged LAN cable, it is something related to tcp only.

    secondly I am not sending data over tcp more than 256 bytes, the code is

    unsigned char GUC_tcp_sck_h;
    unsigned char GUCA_TCP_Tx_Data[256];
    .
    .
    .
    .
    // socket creating & connection establishing
    .
    .
    //assigning some data to buffer GUCA_TCP_Tx_Data
    .
    
    void Transmit_Data(unsigned short length)
    {
        unsigned char * sendbuf;
        sendbuf = tcp_get_buf (length);
        memcpy (sendbuf, GUCA_TCP_Tx_Data, length);
    
        tcp_send (GUC_tcp_sck_h, sendbuf, length);
    }
    

    is something wrong in code ?

Children
  • "but error does not come when I unplugged LAN cable, it is something related to tcp only."

    OK, so you've narrowed it down a bit - keep going!

    "is something wrong in code ?"

    Where is the memory allocated for 'sendbuf' released?

  • The Description of tcp_get_buf () says :

    This function is used to allocate memory for the TCP send buffer. It is called when the application wants to send TCP data packet. The allocated memory buffer will be deallocated by the TcpNet system, when the frame has been sent and acknowledged by remote peer.