lwip-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-devel] How to estimate heap memory usage (TCP case)


From: Simon Goldschmidt
Subject: Re: [lwip-devel] How to estimate heap memory usage (TCP case)
Date: Mon, 12 Mar 2012 17:48:32 +0100

narke <address@hidden> wrote:
> > My TCP_MSS is 1388 and TCP_SND_BUF is 4 * TCP_MSS.
> Does anyone have an idea?  Thank in advance.

Keep in mind that to the MSS, various protocol headers plus struct pbuf is also 
allocated from the heap. That alone would require at least ~5.9KByte heap. 
Without using TCP_OVERSIZE, every write gets its own pbuf, so if you call 
tcp_write with a size != MSS, you risk losing another 72 byte for every call of 
tcp_write that doesn't start a new segment. Added to that, the heap needs its 
own organization structures, so you cannot allocate the full byte count 
configured with MEM_SIZE.

Other than that, have a look at the sources to see who else calls mem_malloc() 
(e.g. DHCP, AutoIP, slipif, ppp, your own code?). The stats also help you 
there. Ideally, before calling tcp_write(), the heap should not be used (when 
DHCP and AutoIP are correctly initialized and not using slip/ppp).

Simon
-- 
NEU: FreePhone 3-fach-Flat mit kostenlosem Smartphone!                          
        
Jetzt informieren: http://mobile.1und1.de/?ac=OM.PW.PW003K20328T7073a



reply via email to

[Prev in Thread] Current Thread [Next in Thread]