Vim在WIndows上占用700MB内存,我该怎么调试呢?

时间:2014-08-26 18:51:03

标签: windows vim

我在Windows Server 2012上安装了Vim,当我从开始菜单启动时,一切正常。但是,当我从命令行启动它需要5秒钟并使用700MB内存。即使它没有打开文件。有一些奇怪的事情,我想知道是否有任何方法来调试它/找出导致这种情况的原因?谢谢,埃里克。

编辑:

以下是vim --startuptime outputfile(缩写)的结果:

次以毫秒为单位

clock self + sourced self:sourced script

时钟已过:其他行

<000> 000000000.000:--- VIM STARTING ---

...

016.000 016.000:解析参数

016.000 000.000:扩大论点

4794.000 4778.000:shell init

4794.000 000.000:Termcap init

...

4825.000 000.000:设置原始模式

8768.000 3943.000:启动termcap

8768.000 000.000:清除屏幕

8783.000 000.000:--- VIM STARTED ---

2 个答案:

答案 0 :(得分:2)

您可以使用Sysinternals的Process Explorer检查是否有任何进程正在启动子进程,或者环境变量是否存在任何差异。

此外,Sysinternals的Procmon允许您检查任何应用程序使用的注册表项,文件等(按command name includes vim过滤),但您可能会发现只与Process Explorer有所不同。

Sysinternals是一家为Windows创建了一些不错的应用程序的公司,微软几年前买了它。您可以在http://live.sysinternals.com

上访问其任何应用的最新版本

答案 1 :(得分:0)

Excerpt from Vim FAQ 2.5

2.5. I have a "xyz" (some) problem with Vim. How do I determine it is a
     problem with my setup or with Vim?  / Have I found a bug in Vim?

First, you need to find out, whether the error is in the actual runtime
files or any plugin that is distributed with Vim or whether it is a
simple side effect of any configuration option from your .vimrc or
.gvimrc. So first, start vim like this: 

    vim -u NONE -U NONE -N -i NONE

this starts Vim in nocompatible mode (-N), without reading your viminfo
file (-i NONE), without reading any configuration file (-u NONE for not
reading .vimrc file and -U NONE for not reading a .gvimrc file) or even
plugin.

In this invocation, try to reproduce your problem. If the error
persists, the chance is good you've found a bug in Vim (see also
Question 2.6. faq-2.6)

If the error does not occur when starting Vim this way, then the problem
is either related to some plugin of yours or some setting in one of your
local setup files. You need to find out, what triggers the error, you
try starting Vim this way: 

    vim -u NONE -U NONE -N

If the error occurs, the problem is your .viminfo file. Simply delete
the viminfo file then. If the error does not occur, try: 

    vim -u ~/.vimrc --noplugin -N -i NONE

This will simply use your .vimrc as configuration file, but not load any
plugins. If the error occurs this time, the error is possibly caused by
some configuration option inside your .vimrc file. Depending on the
length of your vimrc file, it can be quite hard to trace the origin
within that file.

The best way is to add :finish command in the middle of your .vimrc.
Then restart again using the same command line. If the error still
occurs, the bug must be caused because of a setting in the first half of
your .vimrc. If it doesn't happen, the problematic setting must be in
the second half of your .vimrc. So move the :finish command to the
middle of that half, of which you know that triggers the error and move
your way along, until you find the problematic option.

它还提到了如何创建日志文件:

You can also use the -V command line argument to get more debug
information to analyze the problem: 

    $ vim -V2logfile

You can increase the value passed to the -V argument to get more debug
information. By also specifying a logfile name, this makes sure, the
debug messages don't appear on the screen and won't disturb you when
trying to reproduce the problem.