lwip-devel
[Top][All Lists]
Advanced

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

RE: [lwip-devel] memp_std.h and MEM_USE_POOLS


From: Grubb, Jared
Subject: RE: [lwip-devel] memp_std.h and MEM_USE_POOLS
Date: Tue, 27 Nov 2007 13:28:42 -0800

Anyone mind if I add the following sanity checks for memory:

#if (MEM_LIBC_MALLOC && MEM_USE_POOLS)
  #error "You cannot enable both MEM_LIBC_MALLOC and MEM_USE_POOLS in
your lwipopts.h"
#endif
#if (MEM_USE_POOLS && !MEMP_USE_CUSTOM_POOLS)
  #error "MEM_USE_POOLS requires the use of custom pools
(MEMP_USE_CUSTOM_POOLS) in lwipopts.h"
#endif

Jared
        
-----Original Message-----
From: address@hidden
[mailto:address@hidden On Behalf Of
Grubb, Jared
Sent: Monday, November 26, 2007 09:24
To: lwip-devel
Subject: RE: [lwip-devel] memp_std.h and MEM_USE_POOLS

Ugh... I hate Windows and its inability to cope with line breaks...
here's the code and hopefully the line breaks are good!

-----Original Message-----
From: address@hidden
[mailto:address@hidden On Behalf Of
Grubb, Jared
Sent: Monday, November 26, 2007 09:11
To: lwip-devel
Subject: RE: [lwip-devel] memp_std.h and MEM_USE_POOLS

Simon,

As far as setting up a set number, you can define as many as you like.
So:

  * #define MEMP_USE_CUSTOM_POOLS 1 to turn on the custom pools.. 

  * Create a "lwippools.h" in the same directory as your "lwipopts.h"
file (doesn't really have to be in the same directory, but it may as
well be). Here is one I put together for an example... did I upload it
to the CVS somewhere?




/* OPTIONAL: Pools to replace heap allocation
 * Optional: Pools can be used instead of the heap for mem_malloc. If
 * so, these should be defined here, in increasing order according to 
 * the pool element size.
 *
 * LWIP_MALLOC_MEMPOOL(number_elements, element_size)
 */
#if MEM_USE_POOLS
LWIP_MALLOC_MEMPOOL_START
LWIP_MALLOC_MEMPOOL(20, 256)
LWIP_MALLOC_MEMPOOL(10, 512)
LWIP_MALLOC_MEMPOOL(5, 1024)
LWIP_MALLOC_MEMPOOL_END
#endif /* MEM_USE_POOLS */

/* Optional: Your custom pools can go here if you would like to use
 * lwIP's memory pools for anything else.
 */
LWIP_MEMPOOL(SYS_MBOX, 22, sizeof(struct sys_mbox_struct), "SYS_MBOX")
LWIP_MEMPOOL(SYS_SEM, 12, sizeof(struct sys_sem_struct), "SYS_SEM")






-----Original Message-----
From: address@hidden
[mailto:address@hidden On Behalf Of
address@hidden
Sent: Sunday, November 25, 2007 02:30
To: lwip-devel
Subject: [lwip-devel] memp_std.h and MEM_USE_POOLS

Hi,

can someone guide me on how to set up number and size of memp_pools with

the 'new' memp_std.h? I've never really used it since that was changed 
and I'd like to know how it's done to write some documentation about it 
(included in memp_std.h or mem.c).

Simon


_______________________________________________
lwip-devel mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/lwip-devel


_______________________________________________
lwip-devel mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/lwip-devel


_______________________________________________
lwip-devel mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/lwip-devel




reply via email to

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