Loading ...
Sorry, an error occurred while loading the content.

[patch] fixed memory leak in command custom completion

Expand Messages
  • Dominique Pelle
    Hi Command custom completion (:help :command-completion-customlist) is leaking memory when redefining completion for a command multiple times. I see this bug
    Message 1 of 2 , Mar 10, 2009
    • 0 Attachment
      Hi

      Command custom completion (:help :command-completion-customlist)
      is leaking memory when redefining completion for a command
      multiple times. I see this bug in latest Vim-7.2.132.

      The following script illustrates the problem: memory usage keeps
      growing at each iteration when redefining a command completion:

      :function! s:Foo()
      :endfunction

      :function! s:CompleteFoo(a, l, p)
      :endfunction

      :while 1
      : " Leak at each iteration
      : command! -complete=customlist,s:CompleteFoo -nargs=1 Foo :call s:Foo()
      :endwhile

      Attached patch fixes the memory leak.

      Regards
      -- Dominique

      --~--~---------~--~----~------------~-------~--~----~
      You received this message from the "vim_dev" maillist.
      For more information, visit http://www.vim.org/maillist.php
      -~----------~----~----~----~------~----~------~--~---
    • Bram Moolenaar
      ... Thanks! I ll move the vim_free() call to where uc_rep is freed, they belong together. -- What is the difference between a professional and an amateur? The
      Message 2 of 2 , Mar 11, 2009
      • 0 Attachment
        Dominique Pelle wrote:

        > Command custom completion (:help :command-completion-customlist)
        > is leaking memory when redefining completion for a command
        > multiple times. I see this bug in latest Vim-7.2.132.
        >
        > The following script illustrates the problem: memory usage keeps
        > growing at each iteration when redefining a command completion:
        >
        > :function! s:Foo()
        > :endfunction
        >
        > :function! s:CompleteFoo(a, l, p)
        > :endfunction
        >
        > :while 1
        > : " Leak at each iteration
        > : command! -complete=customlist,s:CompleteFoo -nargs=1 Foo :call s:Foo()
        > :endwhile
        >
        > Attached patch fixes the memory leak.

        Thanks! I'll move the vim_free() call to where uc_rep is freed, they
        belong together.

        --
        What is the difference between a professional and an amateur?
        The ark was built by an amateur; professionals gave us the Titanic.

        /// Bram Moolenaar -- Bram@... -- 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
        -~----------~----~----~----~------~----~------~--~---
      Your message has been successfully submitted and would be delivered to recipients shortly.