lwip-users
[Top][All Lists]
Advanced

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

[lwip-users] MEMP_MEM_MALLOC


From: Giuseppe Modugno
Subject: [lwip-users] MEMP_MEM_MALLOC
Date: Tue, 27 Feb 2018 13:08:31 +0100
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0

I'm thinking if it's better to set MEMP_MEM_MALLOC or not in my application. I'm working with MEMP_MEM_MALLOC=1 (I started from an example) and it works. However I'm not sure it's the best choice for me.

So what are the arguments for and against MEMP_MEM_MALLOC?

This is what I have understood:

  • lwip *always* uses pools for some dynamic data (for example UDP PCBs and timeouts);
  • pools have a *fixed* number for maximum allocated elements (for example, MEMP_NUM_SYS_TIMEOUT for timeouts);
  • (MEMP_MEM_MALLOC=0): all the elements of the pools are statically allocated (so they're not in the heap);
  • (MEMP_MEM_MALLOC=1): the elements of the pools aren't statically allocated, but they're (de)allocated at run-time with malloc/free, when needed;
  • allocation of an element is much more fast if MEMP_MEM_MALLOC=0 (otherwise malloc/free are used);
  • MEMP_MEM_MALLOC=0 is a good choice if available malloc/free are poor (in my case, I'm using newlib on Cortex-M3... I don't really know if it's a good implementation or not).

What are your suggestions?



reply via email to

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