Sirjee Rooplall wrote:
Can some explain the difference
between memp_malloc and mem_malloc, or point me to any documentation
that will explain this to me.
mem_malloc allocates data from a heap, much like the std-C malloc.
Since a heap can be slow (to find a suitably sized free area) and can
fragment over time, lwIP prefers to use memory pools (memp_malloc). We
have dedicated pools for many structures, the amount of which is
configurable by the MEMP_NUM_* options (except for PBUF_POOL pbufs,
which are configured by PBUF_POOL_SIZE for historical reasons :-( -
before 1.2.0, the pbuf pool had its own pool implementation).
Does MEMP_NUM_PBUF have to be dfined
for memp_malloc to work?
I never tried setting it to zero, but it should work. If not, we can
make it to.
I am not clear as to what this value
should be set to.
It configures the number of struct pbuf structs in that pool. These
structs are used when allocating PBUF_ROM or PBUF_REF pbufs (as
documented in opt.h). These pbufs are used for IP fragmentation and
NETCONN_NOCOPY (i.e.
TCP_WRITE_FLAG_COPY not set when calling tcp_write).
I receive data from a serial port,
then build a pkt, and use netconn_write with NETCONN_COPY parameter to
send this data to our server through the PPP layer. So having said
this, do I need to define MEMP_NUM_PBUF to a minimal value, what would
happen if it is defined as zero?
Since you are using netconn_write with NETCONN_COPY only, PBUF_ROM/REF
pbufs should never be used (I'd have to verify this, though) and you
might set the define to zero.
Simon
|