Intellij IDEA 编辑器中的光标导航滞后

发布于 2024-11-08 17:20:34 字数 1995 浏览 3 评论 0原文

运行 IDEA 几个小时后,我注意到编辑器中的导航开始滞后。当我输入内容时,大约需要 1-2 秒才能解冻光标。当我打开一个新行时,它也会冻结一段时间(如果我每次都等待直到它解冻,按 Enter 5 次将使 IDEA 冻结大约 10 秒),以及类似的情况。当光标冻结时,感觉它正在后台进行某种搜索(可能是索引搜索)。目前 jvm 堆显示 674MB 中的 292MB。

此类问题可能与哪些问题有关以及如何解决这些问题?

[更新]

还会引发 OutOfMemory 异常。

at com.intellij.util.io.PersistentEnumerator.enumerateImpl(PersistentEnumerator.java:354)
at com.intellij.util.io.PersistentEnumerator.tryEnumerate(PersistentEnumerator.java:175)
at com.intellij.util.io.PersistentHashMap.get(PersistentHashMap.java:219)
at com.intellij.util.indexing.MapIndexStorage$1$1.compute(MapIndexStorage.java:78)
at com.intellij.util.indexing.MapIndexStorage$1$1.compute(MapIndexStorage.java:70)

Caused by: java.lang.RuntimeException: Mapping failed: C:\Users\...\Application Data\.IntelliJIdea90\system\index\idindex\IdIndex, position=0, length=10485760 

at com.intellij.util.io.ReadWriteMappedBufferWrapper.map(ReadWriteMappedBufferWrapper.java:51)
at com.intellij.util.io.MappedBufferWrapper.buf(MappedBufferWrapper.java:68)
at com.intellij.util.io.PagedFileStorage.getBuffer(PagedFileStorage.java:260)
at com.intellij.util.io.PagedFileStorage.get(PagedFileStorage.java:170)
at com.intellij.util.io.PagedFileStorage.getInt(PagedFileStorage.java:121)
at com.intellij.util.io.ResizeableMappedFile.getInt(ResizeableMappedFile.java:141)
at com.intellij.util.io.PersistentEnumerator.enumerateImpl(PersistentEnumerator.java:279)
... 39 more
Caused by: java.io.IOException: Map failed
at sun.nio.ch.FileChannelImpl.map(FileChannelImpl.java:748)
at com.intellij.util.io.ReadWriteMappedBufferWrapper.map(ReadWriteMappedBufferWrapper.java:48)
... 45 more
Caused by: java.lang.OutOfMemoryError: Map failed
at sun.nio.ch.FileChannelImpl.map0(Native Method)
at sun.nio.ch.FileChannelImpl.map(FileChannelImpl.java:745)
... 46 more

[更新 II]

请注意,Windows 任务管理器中的内存使用量显示为接近 1GB(与建议的 292MB 不匹配)。 Intellij 内置内存转储已生成 500MB 的文件。 WTM 显示 Intellij 中的内存也已降至 500MB(但仍然很慢)。

After running IDEA for a few hours I've noticed that navigation starts to lag in the Editor. When I type something in it takes about 1-2 seconds to unfreeze the cursor. When I open a new line it also freezes for a while (pressing enter 5 times would freeze IDEA for around 10 seconds, if I wait every time until it unfreezes), as well as in similar situations. It feels that it is doing some sort of search (maybe index search) in background when the cursor freezes. Currently jvm heap shows at 292MB out of 674MB.

What such problems can be related to and how to troubleshoot them?

[UPDATE]

Also OutOfMemory exception is thrown.

at com.intellij.util.io.PersistentEnumerator.enumerateImpl(PersistentEnumerator.java:354)
at com.intellij.util.io.PersistentEnumerator.tryEnumerate(PersistentEnumerator.java:175)
at com.intellij.util.io.PersistentHashMap.get(PersistentHashMap.java:219)
at com.intellij.util.indexing.MapIndexStorage$1$1.compute(MapIndexStorage.java:78)
at com.intellij.util.indexing.MapIndexStorage$1$1.compute(MapIndexStorage.java:70)

Caused by: java.lang.RuntimeException: Mapping failed: C:\Users\...\Application Data\.IntelliJIdea90\system\index\idindex\IdIndex, position=0, length=10485760 

at com.intellij.util.io.ReadWriteMappedBufferWrapper.map(ReadWriteMappedBufferWrapper.java:51)
at com.intellij.util.io.MappedBufferWrapper.buf(MappedBufferWrapper.java:68)
at com.intellij.util.io.PagedFileStorage.getBuffer(PagedFileStorage.java:260)
at com.intellij.util.io.PagedFileStorage.get(PagedFileStorage.java:170)
at com.intellij.util.io.PagedFileStorage.getInt(PagedFileStorage.java:121)
at com.intellij.util.io.ResizeableMappedFile.getInt(ResizeableMappedFile.java:141)
at com.intellij.util.io.PersistentEnumerator.enumerateImpl(PersistentEnumerator.java:279)
... 39 more
Caused by: java.io.IOException: Map failed
at sun.nio.ch.FileChannelImpl.map(FileChannelImpl.java:748)
at com.intellij.util.io.ReadWriteMappedBufferWrapper.map(ReadWriteMappedBufferWrapper.java:48)
... 45 more
Caused by: java.lang.OutOfMemoryError: Map failed
at sun.nio.ch.FileChannelImpl.map0(Native Method)
at sun.nio.ch.FileChannelImpl.map(FileChannelImpl.java:745)
... 46 more

[UPDATE II]

Note that in Windows Task Manager memory usage is shown at nearly 1GB (which doesn't match suggested 292MB). Intellij built-in memory dump has produced a 500MB file. WTM shown memory in Intellij has gone down to 500MB as well (but it is still slow).

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

你的呼吸 2024-11-15 17:20:34

我曾经遇到过这些类型的问题,它们似乎与源代码控制集成(特别是 Perforce)有关。如果您使用源代码管理,请尝试禁用它并看看会发生什么。

I used to have these types of problems and they seemed to be related to source control integration (Perforce in particular). If you use source control, try to disable it and see what happens.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文