idea 在debug时遇见启动非常慢的情况,Method breakpoints may dramatically slow down debugging的解决与剖析

有时候打断点进行debug的时候,会出现这样的情况,启动的特别慢,甚至启动不起来。后来经过各种努力检查最后发现是断点打在了方法上。

解决办法:

打开debug界面并点击如下图所示:
在这里插入图片描述
就可以看见自己打得所有断点:
在这里插入图片描述
圆形红点中有四个点的就是打在方法上的断点

双击这个方法就可以快速定位到这里,取消掉它就可正常启动debug了。

出现的原因

  • 为什么会出现这样的情况呢? 方法上不能打断点吗
    是因为JVM的设计,方法断点会大大减慢调试器的速度。所以说想要debug的快,尽量避免方法断点。

Debugger performance can be affected by the following:

  • Method breakpoints will slow down debugger a lot because of the JVM design, they are expensive to evaluate. Remove method breakpoints and consider using the regular line breakpoints. To verity that you don’t have any method breakpoints open .idea/workspace.xml file in the project root directory (or .iws file if you are using the old project format) and look for any breakpoints inside the method_breakpoints node.
  • Watch method return values option is enabled in the Debugger Panel. Try disabling this option to improve the performance.
  • Enable alternative views for Collections classes and Enable toString()’ object view options enabled in Settings | Debugger | Data Views. If toString() methods take a long time to complete, disable this option. Note that custom toString() methods can also change the semantics of the application when running under debugger in case the code inside these methods changes the state of your application.
  • Memory tab in the debugger toolwindow. It is updated on every debugger stop, try to minimize it to improve stepping performance.
    详情可参考:
    https://intellij-support.jetbrains.com/hc/en-us/articles/206544799-Java-slow-performance-or-hangups-when-starting-debugger-and-stepping
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值