I'm trying to chase down an out of heap memory problem when a TCP socket is created. heap2 malloc fails requesting 5872 bytes. This looks like it's based on creating stream buffers via...
#define ipconfigTCP_RX_BUF_LEN ( 4 * ipconfigTCP_MSS ) /* defaults to 5840 bytes */
/* Define the size of Tx stream buffer for TCP sockets */
define ipconfigTCPTXBUFLEN ( 4 * ipconfigTCPMSS ) /* defaults to 5840 bytes */
This seems ot add up to >10K per tcp socket. Can I reduce TCP_MSS to something smaller? Can it be less than an ethernet Mtu?
About posting: you can include literal code if you put it between two lines which only contain 5 tildas
~~~~~, as here:
int function( void )
/* This is a comment */
I'm glad you traced down the problem.
This seems ot add up to >10K per tcp socket. Can I reduce
TCP_MSS to something smaller? Can it be less than an ethernet Mtu?
This is a TCP packet:
1) Ethernet header = 14 bytes
2) IP-header = 20 bytes
3) TCP-header = 20 bytes
4) TCP contents/payload <= MSS
MTU (Maximum Transmission Unit) equals MSS + 40.
The 'Ethernet header' of 14 bytes is not included in the MTU.
I would recommend bringing down the MTU for testing, e.g.:
#define ipconfigNETWORK_MTU 800
The value of MSS will automatically adapt:
#define ipconfigTCP_MSS ( ipconfigNETWORK_MTU - ipSIZE_OF_IP_HEADER - ipSIZE_OF_TCP_HEADER )
which is 1000 - 40 = 960 bytes.
This post might also be interesting for you:
Are you using BufferAllocation2.c? If so, please note you need to use heap4.c, not heap2.c:
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.