[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lwip-devel] How to estimate heap memory usage (TCP case)
From: |
narke |
Subject: |
Re: [lwip-devel] How to estimate heap memory usage (TCP case) |
Date: |
Tue, 13 Mar 2012 01:32:41 +0800 |
On 13 March 2012 00:48, Simon Goldschmidt <address@hidden> wrote:
>
> 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.
Thanks for your reply Simon. Did you get the number 5.9KB from my
TCP_MSS value? How did you calculate this magic number?
> 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.
I am not quite understand the TCP_OVERSIZE. My current setting is
TCP_OVERSIZE = TCP_MSS. What does it mean? And, with a higher or
lower TCP_OVERSIZE value, will lwIP use more or less momory? What's
the idea TCP_OVERSIZE setting to archive minimum memory use without
worrying about my segment get fragmented?
>
> 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).
Yes, this I understand. I will separably count my other mem_alloc() uses.
>
> Simon
> --
> NEU: FreePhone 3-fach-Flat mit kostenlosem Smartphone!
> Jetzt informieren: http://mobile.1und1.de/?ac=OM.PW.PW003K20328T7073a
>
> _______________________________________________
> lwip-devel mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/lwip-devel
--
Life is the only flaw in an otherwise perfect nonexistence
-- Schopenhauer
narke
public key at http://subkeys.pgp.net:11371 (address@hidden)