gpt4 book ai didi

debugging - 在 Debug模式下运行 JVM 的副作用

转载 作者:行者123 更新时间:2023-12-03 00:09:15 24 4
gpt4 key购买 nike

我想在 Debug模式下重新发布 Java 应用程序,以便在客户端出现随机或难以重现的问题时更轻松地进行调试。

但是,我想了解一下这样做的潜在副作用?从 Java HotSpot 文档来看,似乎有 should be no performance penalty

来自链接

Full Speed Debugging

The Java HotSpot VM now uses full-speed debugging. In previous version of the VM, when debugging was enabled, the program executed using only the interpreter. Now, the full performance advantage of HotSpot technology is available to programs, even with compiled code. The improved performance allows long-running programs to be more easily debugged. It also allows testing to proceed at full speed. Once there is an exception, the debugger launches with full visibility to code sources.

这是否准确,是否存在隐藏的警告,内存占用情况如何,以及使用 Debug模式时是否存在任何其他隐藏的问题。

PS:我找到了this article来自 AMD 的消息证实了我最初的怀疑,即 oricale 的原始文章并未展示完整的故事。

最佳答案

我不能代表 HotSpot,也不会正式代表 IBM,但我会说,肯定存在合法类型的优化,如果中间需要反编译,则无法完全撤消这些优化,并且因此,当您可能使用的生产 JVM 中要求进行调试时,不会启用此功能。

想象一种情况,优化器发现程序的一部分被证明是不需要的,并且根据各种语言规则(包括 JSR 133)可以合法删除,JVM 将希望摆脱它。一个问题是调试:删除代码对于人类单步执行它来说看起来很奇怪(变量不更新,单步执行时可能不会停止在行上),因此选择是在这些情况下禁用所述优化。对于堆栈分配对象等选项也可能如此。因此,虽然 JVM 说它是“全速”,但实际上更接近“几乎全速,其中一些更时髦的选项无法完全撤消删除” .

关于debugging - 在 Debug模式下运行 JVM 的副作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3722841/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com