Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Wireshark-dev: Re: [Wireshark-dev] [Wireshark-commits] rev 50955: /trunk/epan/wmem/ /trunk/epan

From: Evan Huus <eapache@xxxxxxxxx>
Date: Sat, 27 Jul 2013 19:11:11 -0400
On Sat, Jul 27, 2013 at 6:27 PM,  <eapache@xxxxxxxxxxxxx> wrote:
> http://anonsvn.wireshark.org/viewvc/viewvc.cgi?view=rev&revision=50955
>
> User: eapache
> Date: 2013/07/27 03:27 PM
>
> Log:
>  Redesign of the wmem block allocator.
>
>  What was becoming apparent as more dissectors started using wmem was that the
>  old block allocator design had issues with memory fragmentation. This keeps the
>  same underlying memory layout, but completely changes how free blocks are kept.
>  It runs about 3% slower in my tests (still an order of magnitude faster than
>  g_malloc) but uses about 1/3 the memory.
>
>  I suspect some simple optimizations could reclaim that 3% as well - the design
>  is fast, but I did not code particularly for speed.
>
>  Thoroughly tested with the existing test suite (which caught half a dozen bugs
>  in my first draft) so it should actually work!
>
> Directory: /trunk/epan/wmem/
>   Changes    Path                      Action
>   +370 -297  wmem_allocator_block.c    Modified

Regarding performance, just disabling the assertions gives about 15%
in my tests, but that was true of the old version as well. However,
the code is complicated and the assertions are a good safeguard, so
I'd rather not disable them just yet...