[Top][All Lists]

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

Re: [lwip-users] Understanding memory configuration

From: address@hidden
Subject: Re: [lwip-users] Understanding memory configuration
Date: Mon, 17 Sep 2018 22:28:27 +0200
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1

On 17.09.2018 22:20, Andy Pont wrote:
That macro allocates pools of X elements with Y bytes each.
It allocates (14 * 75) + (6 * 225) + (1 * 525) + (3 * 1540) bytes plus a little offset for administration, so roughly 7,5 kB.
Is that memory being allocated by the linker in either the .data or .bss sections

Yes. Just follow the defines:

LWIP_MALLOC_MEMPOOL() -> LWIP_MEMPOOL() -> LWIP_MEMPOOL_DECLARE() -> memp.h lint 95 (git head) instantiates the memory via LWIP_DECLARE_MEMORY_ALIGNED()

Ok, this isn't fun to read from the code, but that's the price for making it configurable ;-)

or is it pulled from the heap using malloc()?

lwIP does *not* use malloc() unless you tell it to!

They also seem like some really weird combinations of numbers and appear to be one of those things that never got documented anywhere.  Any guesses?

No. Well, smallest packets are 60 bytes + 16 bytes for struct pbuf and largest packets are ~1514 bytes + 16 bytes for struct pbuf. Add alignment to this and the smallest and largest pool might make sense...


reply via email to

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