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

Ethereal-dev: Re: [Ethereal-dev] MemWatch - detecting memory leaks

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Ulf Lamping <ulf.lamping@xxxxxx>
Date: Sun, 20 Feb 2005 14:18:06 +0100
Giles Scott wrote:

Hi,
Has anyone managed to compile Ethereal with MemWatch?
http://memwatch.sourceforge.net
That would be difficult. We are using GLib, which provides a g_malloc() function for the malloc purpose (external and internal in the library).

As MemWatch uses a simplistic approach, simply #define malloc() to it's own function mwMalloc() that won't work for us.

So you might be able to compile Ethereal with MemWatch, but it won't "see" any malloc/free/... functions.

I think there are a couple of memory leaks still :-(
If I open a large capture on WinXP memory util goes from 400mb to
1000mb.
After closing ethereal memory goes down to 600mb, leaking 200mb.
There are a lot of things malloced the first time used and then reused the next time again (agreed that this *could* be improved). So it's possibly not a memory leak in the way I see it as "common sense".

Will it still increase the next time (open/close) a file and again you got much increased memory? If that's the case, I would call it a real memory leak.

Or has anyone got a better way to find memory leaks?
Not a portable one.

The memory profiling support in GLib is simplistic too. Even if you would provide your own malloc() functions and use g_mem_set_vtable() to insert it into GLib, you would get the information that it leaks memory (well, we know that already) but not the places where it malloced the leaked memory (file/linenumber) which would be the information needed to fix it with reasonable effort.

There are non portable tools both for linux and windows (and probably others, don't know) like Boundschecker on Windows (commercial and expensive).

As you seem to use WinXP, I don't know of any good free alternative, but maybe someone else knows one?

Regards, ULFL