运行 IDEA 几个小时后,我注意到编辑器中的导航开始滞后。当我输入内容时,大约需要 1-2 秒才能解冻光标。当我打开一个新行时,它也会卡住一段时间(如果我每次都等待直到它解冻,按 Enter 5 次将使 IDEA 卡住大约 10 秒),以及类似的情况。当光标卡住时,感觉它正在后台进行某种搜索(可能是索引搜索)。目前 jvm 堆显示为 292MB(共 674MB)。
此类问题可能与哪些问题相关以及如何解决这些问题?
[更新]
此外,还会引发 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
[更新二]
请注意,Windows 任务管理器中的内存使用量显示为接近 1GB(与建议的 292MB 不匹配)。 Intellij 内置内存转储已生成 500MB 的文件。 WTM 显示 Intellij 中的内存也已降至 500MB(但仍然很慢)。
最佳答案
我曾经遇到过这些类型的问题,它们似乎与源代码控制集成(特别是 Perforce)有关。如果您使用源代码管理,请尝试禁用它,看看会发生什么。
关于java - Intellij IDEA 编辑器中的光标导航滞后,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6065333/