memory leak detection patch

Andreas Mohr andi at
Thu Sep 22 02:51:55 CDT 2005


On Thu, Sep 22, 2005 at 12:08:20AM +0900, Mike McCormack wrote:
> Hi,
> This patch is written for MSI, but could be adapted to other code.  It 
> keeps a linked list of allocated memory and removes free'd memory from 
> the list.
> It requires that you change all the HeapAlloc's or mallocs in a dll to 
> msi_alloc (for example), but can detect unfree'd memory and invalid free's.
> I have discovered quite a few problems in my own code with this patch, 
> so hopefully somebody else will find it useful too.

First, thanks for fixing so many leaks!

I think that we should concentrate on making valgrind the default leak
detection method in Wine, however.

- it catches many, many leaks *without any reprogramming effort*
- it catches many, many other problems
- it has other tools which are very useful, too (cache profiling, ...)
- it's so much better than any other "clever hack" that people come up with
  in 2 hours

Thus IMHO valgrind should work perfectly with Wine, and it should be the
first thing that pops up when people want to do things like this: IOW
it should be documented rather prominently which are some useful ways of
using it in combination with Wine.

OTOH we might want to put a safety net in place in case valgrind somehow
becomes impossible to use in combination with Wine, so maybe we should
investigate a second leak tracer, too.

Or am I completely mistaken here?


More information about the wine-devel mailing list