内存分配的两种策略:1. 内存堆分配 2.内存池分配
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/* MEM_SIZE: the sizeof the heap memory. If the application will send a lot of data that needs to becopied, this should be set high. */ /* MEM_SIZE: 设置堆内存的大小. 如果应用程序需要发送大量需要被拷贝的数据, 应该将此值设置大一些. */
#define MEM_SIZE 1600
/* MEMP_NUM_PBUF: thenumber of memp struct pbufs (used for PBUF_ROM and PBUF_REF). If theapplication sends a lot of data out of ROM (or other static memory), thisshould be set high. */ /* MEMP_NUM_PBUF: 堆内存pbufs的数目 (用于PBUF_ROM 和 PBUF_REF). 如果应用程序需要从ROM(或者其他静态内存)中发送大量数据,应该将此值设置大一些. */ #define MEMP_NUM_PBUF 16
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/* PBUF_POOL_SIZE:the number of buffers in the pbuf pool. */ /* PBUF_POOL_SIZE: 要切的份数. */
#define PBUF_POOL_SIZE 16
/* PBUF_POOL_BUFSIZE:the size of each pbuf in the pbuf pool. The default is designed to accomodatesingle full size TCP frame in one pbuf, including TCP_MSS, IP header, and linkheader. */ /* PBUF_POOL_BUFSIZE: 每一份的大小. */
#define PBUF_POOL_BUFSIZE LWIP_MEM_ALIGN_SIZE(TCP_MSS+40+PBUF_LINK_HLEN)
疑问:这些参数的大小该如何确定? the number of memp struct pbufs到底是什么意思?被这几个参数搞得很晕啊,希望过来人给指点指点。。。
|