Wireshark-dev: Re: [Wireshark-dev] New classes of possible memory optimizations

From: Jeff Morriss <jeff.morriss.ws@xxxxxxxxx>
Date: Fri, 15 Feb 2013 14:21:14 -0500
Evan Huus wrote:
It is now possible with wmem to free individual allocated chunks (this
does not affect the bulk-free that occurs after each packet or file).
I don't expect it to be used much directly, however if there are large
buffers that are needed only briefly, freeing them immediately
afterwards could do good things for Wireshark's memory usage. If an
exception is thrown and the free call is never hit, they will still be
cleaned up after the packet or file is closed as usual.

Also note that wmem supports realloc as well, so things like emem's
strbuf now have a much simpler and more efficient way to grow (or
shrink) when needed.

This thread:

https://www.wireshark.org/lists/wireshark-dev/201208/msg00179.html

shows a good use case for it. (AFAIK the SCTP dissector is still using double memory when doing reassembly.)