Hello,


i need some advice about how to use the perl interface functions 
curbuf->Append() and curbuf->Delete().



Basically i want to replace/update the content of a buffer. For that, i 
use the function below. At first it seemed to work well, but when i 
looked at the memory consumption, i was surprised to see that it keeps 
growing, with each time i call the function (simply put,  press f9 for 
3-5secs).i would have 
expected that a Delete returns the memory consumption back to 
original... but it is not the case.

Could you provide some explanation why this occurs and advise how to prevent 
this?



Note that the function below is not the original function. it is just a 
test function, which allows to reproduce the problem easily. 



Thanks

Bruno



map <F9> :call <SID>Testfunction()<cr>

function! s:Testfunction() "{{{

    if ! exists("g:testfunction")

     :new 

     setlocal noswapfile

    endif

    let g:testfunction = 1

    perl << BLA

    my $nbOfLines = $main::curbuf->Count();

 

    $main::curbuf->Delete(1,$nbOfLines);

    $main::curbuf->Append(0,(1..20000));

 #   @a=(1..20000);

 BLA

 endfunction "}}}

 



my vim version:


VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Mar 24 2011 07:07:46)


Included patches: 1-35


Modified by [email protected]

-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Reply via email to