Dominique Pelle wrote:

> Valgrind memory checker detects mismatches between malloc()/vim_free()
> and alloc()/free in vim-7.2.30:
> 
> - If malloc() is used, then free() should be used,
> - if alloc() is used, then vim_free() should be used.
> 
> It only really matters when compiling vim with '#define MEM_PROFILE',
> because MEMPROFILE adds one word before each allocated block so
> a mismatch results not only in an illegal free, but also gives incorrect
> memory profile results.  Normally MEMPROFILE is not defined, so it's a
> minor bug.
> 
> Here is an error reported by valgrind:

[...]

> Here memory is allocated with malloc inside SmcOpenConnection(), so it
> should be freed by free() instead of vim_free().
> 
> Here is a memory profile before & after fix, when doing "vim -u NONE" and
> quiting immediately.  Before fix, notice that it reports 6 allocated blocks
> >8199, and only 4 of them are reported as freed when exiting. 2 of those
> large blocks are actually spurious and result from the mismatches.
> 
> After fix, it reports 4 allocated blocks >8199 and all 4 of them are reported
> as freed.
> 
> Before fix:

[...]

> Attached patch fixes above 2 mismatches detected by valgrind + a couple
> of other mismatches which I found by looking at the code.  I may have
> missed some, but at least I do not see other such errors with valgrind
> so far.

Thanks for looking into this.  I'll include the patch later.

-- 
$ echo pizza > /dev/oven

 /// Bram Moolenaar -- [EMAIL PROTECTED] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\        download, build and distribute -- http://www.A-A-P.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Raspunde prin e-mail lui