Dominique Pelle wrote:

> Vim is leaking memory when doing 'set keymap='
> 
> You can reproduce the memory leak by running the
> following script and observe memory usage (with 'top')
> which keeps increasing continuously:
> 
>   :while 1
>   :  set keymap=esperanto
>   :  set keymap=
>   :endwhile
> 
> The leak happens regardless of the keymap, I only
> chose 'esperanto' as an example.  The same leak also
> happens when doing 'set arabic' & 'set noarabic'
> since it implies a 'set keymap=arabic'.
> 
> Valgrind memory checker points to following location
> for the leak:
> 
> ==7572== 4,856,970 bytes in 571,416 blocks are definitely lost in loss
> record 42 of 42
> ==7572==    at 0x4022AB8: malloc (vg_replace_malloc.c:207)
> ==7572==    by 0x810FA74: lalloc (misc2.c:862)
> ==7572==    by 0x810F990: alloc (misc2.c:761)
> ==7572==    by 0x810FE2B: vim_strnsave (misc2.c:1179)
> ==7572==    by 0x8062AA5: ex_loadkeymap (digraph.c:2493)
> ==7572==    by 0x80A42F1: do_one_cmd (ex_docmd.c:2625)
> ==7572==    by 0x80A1B98: do_cmdline (ex_docmd.c:1099)
> ==7572==    by 0x809FE48: do_source (ex_cmds2.c:3119)
> ==7572==    by 0x809F35F: source_callback (ex_cmds2.c:2563)
> ==7572==    by 0x809F53C: do_in_runtimepath (ex_cmds2.c:2657)
> ==7572==    by 0x809F389: source_runtime (ex_cmds2.c:2577)
> ==7572==    by 0x806289F: keymap_init (digraph.c:2429)
> ==7572==    by 0x813B623: did_set_string_option (option.c:5782)
> ==7572==    by 0x81397C0: do_set (option.c:4659)
> ==7572==    by 0x80B0F19: ex_set (ex_docmd.c:10862)
> ==7572==    by 0x80A42F1: do_one_cmd (ex_docmd.c:2625)
> ==7572==    by 0x80A1B98: do_cmdline (ex_docmd.c:1099)
> ==7572==    by 0x809FE48: do_source (ex_cmds2.c:3119)
> ==7572==    by 0x809F763: cmd_source (ex_cmds2.c:2746)
> ==7572==    by 0x809F6B7: ex_source (ex_cmds2.c:2719)
> ==7572==    by 0x80A42F1: do_one_cmd (ex_docmd.c:2625)
> ==7572==    by 0x80A1B98: do_cmdline (ex_docmd.c:1099)
> ==7572==    by 0x80A1238: do_cmdline_cmd (ex_docmd.c:705)
> ==7572==    by 0x80E5357: exe_commands (main.c:2665)
> ==7572==    by 0x80E2D87: main (main.c:875)
> 
> Attached patch fixes it.
> 
> I'm using Vim 7.1.330 (huge) on Linux x86.

Good catch!

-- 
hundred-and-one symptoms of being an internet addict:
88. Every single time you press the 'Get mail' button...it does get new mail.

 /// 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