中文网好像不好找......解决了这个问题后电脑速度明显的快多了(英文是必须要耐心的看下去的)

Go to start of metadata

For an intelligent IDE it is essential to be in the know about any external changes in files it working with - e.g. changes made by VCS, or build tools, or code generators etc. For that reason, IntelliJ platform spins background process to monitor such changes. The method it uses is platform-specific; and on Linux it is Inotify facility.

Inotify requires a "watch handle" to be set for each directory in the project. Unfortunately, the default limit of watch handles may not be enough for reasonably sized projects, and reaching the limit will force IntelliJ platform to fall back to recursive scans of directory trees.

To prevent this situation it is recommended to increase the watches limit (to, say, 512K). You can do it by adding following line to the /etc/sysctl.conf file:

fs.inotify.max_user_watches = 524288

Then run this command to apply the change:

sudo sysctl -p

And don't forget to restart your IDE.

Note: the watches limit is per-account setting. If there are other programs running under the same account which also uses Inotify the limit should be raised high enough to suite needs of all of them.

Labels:
None
  1. Dec 16, 2010

    Hi - any idea where I'd find sysctl.conf in IntelliJ 10 (Community Edition) installed on Ubuntu?

    1. Dec 16, 2010

      /etc/sysctl.conf
      It is a system file, not an IDEA one.

      1. Dec 16, 2010

        Whoops! Thank you

  2. Jan 19, 2011

    FYI: this solution does not seem to work under CentOS not sure what the correct fix is at this point.

  3. Jan 19, 2011

    OK, should have looked first, here's the procedure for CentoOS

    1. To the end of /etc/sysctl.conf add the line: fs.inotify.max_user_watches = 5242881
    2. Apply the changes with the command sysctl -p
    1. Jan 19, 2011

      Sorry, but what's the difference? You just increased the limit to over 5 million (5,242,881 instead of proposed 524,288). Is there any point to set the limit that high?

  4. Nov 03, 2011

    Considering the following situation: 10 developers work on the working copies, mounted via sshfs from a single server. Don't ask me why, it's not my call.
    Should I adjust this settings on developers' working stations and also on server with the value 10 times as big?

    1. Nov 03, 2011

      Though I've never tried it over sshfs but I'm pretty sure it won't work. Network-mounted FS don't produce file change notifications.

  5. Nov 08, 2011

    On Fedora, and I suspect other Linux OSes too, the correct solution is not to edit /etc/sysctl.conf but rather to create a new file in /etc/sysctl.d such as "/etc/sysctl.d/idea.conf" and place the config line there.

    1. Nov 08, 2011

      Sysctl.d is more for packages. It's ok to place user-configured settings in sysctl.conf.

      1. Nov 08, 2011

        Speaking of packages, it would be nice to have one.

        Meanwhile I'd also put the change into a separate file under /etc/sysctl.d .

        1. Nov 08, 2011

          http://youtrack.jetbrains.net/issue/IDEA-22750
          I'm not telling not to do, just saying sysctl.conf is quite a correct way too.

  6. Sep 17, 2013

    In ubuntu 12+, you needn't edit the sysctl.conf file. Just do

    sudo sysctl fs.inotify.max_user_watches=xxxxx

    This updates the entry in /proc/sys/fs/inotify/max_user_watches but does not seem to modify the /etc/sysctl.conf file.

    1. Sep 18, 2013

      Right, but it will last only until reboot.

      1. Sep 19, 2013

        Yup. True that. Modified sysctl.conf (like I should have in the first place!) and it worked like a charm.

        Thanks Roman.

  7. Oct 15, 2013

    JRo

    I don't understand why it is necessary to set up this limit so high. And it not a good thing to give such a hight value as the must-do in a wiki !

    I f you google a little bit, you'll find that the memory used by inotify is 540 * nb of watches on 32bit systems and so 1080 on 64bit ones. 524288 * 1080 = 566 231 040 => 540MiB only for that !

    Stackoverflow suggest to count your files to give you a closer idae of how much you really need. I done wih only 92000 max watches on my 8Go source dir .

    http://stackoverflow.com/questions/535768/what-is-a-reasonable-amount-of-inotify-watches-with-linux

    http://askubuntu.com/questions/154255/how-can-i-tell-if-i-am-out-of-inotify-watches

    1. Oct 21, 2013

      The links provided clearly say that unused watches does not take any memory.

  8. Nov 11, 2013

    For Arch Linux users, this solution won't work after version 207 according to this news. But the news also give a work around.

    Following for the lazy people:

    # vi /etc/sysctl.d/99-sysctl.conf

    Then add the line mentioned above:

    fs.inotify.max_user_watches = 524288

    Or you can just:

    # echo "fs.inotify.max_user_watches = 524288" >> /etc/sysctl.d/99-sysctl.conf

    Don't forget:

    # sysctl -p

    1. Jan 21, 2014

      While running sysctl -p on Arch Linux I got:

      sysctl: cannot open "/etc/sysctl.conf": No such file or directory

      The correct command seems to be:

      # sysctl -p /etc/sysctl.d/99-sysctl.conf

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值