lwip-devel
[Top][All Lists]
Advanced

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

[lwip-devel] [bug #3031] Implement a new fully pool-based pbuf implement


From: Atte Kojo
Subject: [lwip-devel] [bug #3031] Implement a new fully pool-based pbuf implementation.
Date: Fri, 09 Mar 2007 13:58:45 +0000
User-agent: Mozilla/5.0 (compatible; Konqueror/3.5; Linux) KHTML/3.5.5 (like Gecko)

Follow-up Comment #2, bug #3031 (project lwip):

I'm also in favor of a general pool allocator. But the current memp
implementation is unnecessarily complex. It reserves separate pools for all
possible object types that can be allocated, thus wasting a lot of space and
time. And on top of that pbuf module has its own pool.

In my implementation I have replaced memp_malloc and memp_free with
uC/OS-II's similar functions and two pools, one big for tcp_pcbs and one
small for everything else. This simplified the code tremendously and brought
also a nice performance gain.

Rewriting the memp module to use 3 or 4 pools with exponentially bigger pools
and using this module for all memory allocation inside lwIP core should reduce
code footprint and also make memory allocation and deallocation a lot faster.
An example of a 3-pool scheme could be:

pool #1: small chunks for all dynamically allocated structures inside lwIP
(excluding tcp_pcb, which is HUGE).
pool #2: 128-byte chunks for small packets and tcp_pcbs (must be at least
sizeof(tcp_pcb))
pool #3: 1536-byte chunks for big packets (MTU of ethernet is 1500, but I
rounded it up a bit (1536 == 3 * 2^9)).

Making all pool sizes a multiple of 8 also guarantees that dynamically
allocated memory always satisfies alignment restrictions.

With some simple statistics collecting, user could tune the size of each pool
individually for the application at hand and the resulting RAM footprint would
probably be smaller that what lwIP currently has with its multiple memory
allocation schemes.

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?3031>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/





reply via email to

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