Wireshark-dev: Re: [Wireshark-dev] Some wmem wishes

From: Evan Huus <eapache@xxxxxxxxx>
Date: Mon, 30 Sep 2013 06:54:48 -0400
> On Sep 30, 2013, at 3:21 AM, Joerg Mayer <jmayer@xxxxxxxxx> wrote:
> 
> Hello,
> 
> two things that I've thought about:
> 1) Should epan/wmem/wmem.h be moved to epan/wmem.h and
>   the wmem_ prefix be removed from the files in epan/wmem/?

I have no objection to this, but I seem to recall a concern about file name conflicts even when the files are not in the same directory. Something not all build systems handle gracefully? I don't really remember.

> 2) Is there a method to display the size of the pool associated with a
>   scope on a per packet basis? That way would make it simpler to see
>   where (long term) memory goes. For integration maybe something like
>   a pseudo element frame.wmem.scopeX to make it easily accessible via
>   tshark -e ...

I think usually Massif (one of the tools bundled with valgrind) is the easiest way to do this. It only works on Linux (and certain old macs) unfortunately, and doesn't break down precisely by packet, but it does give a nice breakdown of which code paths are using various percentages of heap-allocated memory. There may be similar tools for other platforms, I don't know.

On any platform with valgrind, just pass the -m option to tools/valgrind-wireshark.sh and then run ms_print on the resulting output file. The output isn't ideal, but it's good enough I don't think it's worth the time to write our own version.

> I would be willing to do 1) but 2) would take me close to forever.
> 
> Ciao
>     Jörg
> -- 
> Joerg Mayer                                           <jmayer@xxxxxxxxx>
> We are stuck with technology when what we really want is just stuff that
> works. Some say that should read Microsoft instead of technology.
> ___________________________________________________________________________
> Sent via:    Wireshark-dev mailing list <wireshark-dev@xxxxxxxxxxxxx>
> Archives:    http://www.wireshark.org/lists/wireshark-dev
> Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
>             mailto:wireshark-dev-request@xxxxxxxxxxxxx?subject=unsubscribe