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.
Mike
Hi,
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.
Reasons: - 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?
Andreas
Andreas Mohr wrote:
I think that we should concentrate on making valgrind the default leak detection method in Wine, however.
Reasons:
- 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
Valgrind is great, and I've used it before, but it's a little heavy duty for what I want at the moment.
The main disadvantages are:
- it slows down Wine and programs running Wine. (Office 2003 install already takes a minute or so) - it doesn't differenciate between Wine leaking memory and a program running in Wine leaking memory - it requires a patched version of Wine to run - it isn't built into Wine (ie. I could ship this patch with minimal overhead, and have my users point out memory leaks) - it has issues following forks, and being run from scripts
The patch is not meant to replace valgrind, just to provide another way of finding problems in Wine code.
Mike
Hi Mike
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.
Nice Hint. I will reuse that, while working on the Printing subsystem.
so hopefully somebody else will find it useful too.
should we implement this for all with something like:
WINEHEAP_DEFINES(prefix) wineheap_alloc wineheap_realloc . . . wineheap_dump_allocated_memory
--- Detlef Riekenberg wine.dev@web.de wrote:
Hi Mike
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.
Nice Hint. I will reuse that, while working on the Printing subsystem.
so hopefully somebody else will find it useful too.
should we implement this for all with something like:
WINEHEAP_DEFINES(prefix) wineheap_alloc wineheap_realloc . . . wineheap_dump_allocated_memory
There's a possibility that WINEs heap management is going to be improved at some point by keeping all small allocations together and caching them to improve performance and reduce fragmentation. I'm not sure how much this is vaporware but it could be fairy well intergrated with some kind of memory tracking system.
Oliver
-- By By ... ... Detlef
___________________________________________________________ How much free photo storage do you get? Store your holiday snaps for FREE with Yahoo! Photos http://uk.photos.yahoo.com