On 4/4/07, Max Dyckhoff <[EMAIL PROTECTED]> wrote:
My instance of vim (gvim on Windows) appears to have a memory leak, which makes 
me sad. Is this a common thing for everyone, or is there something in my setup 
which might be causing it? It's pretty serious.

When I start gvim and load my standard session, it will take up about 86MB of 
RAM. This includes dozens of buffers, splits, tabs and syntax, so I'm not 
really worried. After about four hours it will be up to more like 120MB, and 
after a couple of days it will be 200MB+.

Loading a "fresh" copy of gvim with all the plugins and my .vimrc, there are 
various actions I can see that increase the memory usage as reported by the Windows Task 
Manager. I have no idea on the validity of the Task Manager, but it's all I have on 
Windows.

        :sp on a new buffer causes a raise of 4-8K.
        :q on a split causes a raise of 4-8K.
        Switching to/from gvim causes a small increase, typically 4-8K for a 
few switches.
        Searching (with *) for a word in a .c file (with syntax highlighting) 
causes it to increase. If you hold down * then you can see the memory usage 
rocket up.
        Basically, pretty much any action.

Any ideas? Will I just have to live with it and restart my vim session every 
couple of days?

Max,

I recalled two more things. Is your 'hidden' option set ? If it's set,
vim *will* grow. With 'hidden' set, vim will keep in memory much data
about old buffers. If you want to minimize memory, first thing you'd do is
':set nohidden'. To check your current state, 'set hidden?'.

Second important thing is :bw. Even with ':set nohidden', vim will
remember some data for every file it ever visited. To free this data
completely, you need to :ls!, then :bw for every unused buffer.

I think these two things will decrease vim's memory footprint
(in case you had 'set hidden').

Yakov

Reply via email to