为什么我在发布版本中遇到堆栈下溢(错误 1024)?
我遇到了这个奇怪的问题,堆栈下溢错误仅发生在 Flex Builder 项目的发布版本中。我在网上寻找解决方案,但是虽然我找到了一些相关的帖子,但没有什么真正能帮助我。所以这是这个问题和我的答案中的解决方案,希望它可以帮助其他人。
问题:我将一个 java 程序(一个游戏)移植到 Flex 上,并且它在 Android、Web 和 Playbook 上的调试模式下运行良好。然而,当我构建游戏的发行版本时,它崩溃了。根据Adobe的文档,报告的错误是1024,即堆栈下溢。
起初,我以为问题仅限于 Playbook,但事实并非如此,完全相同的问题发生在网络浏览器和 Android 上的完全相同的位置。从我插入的调试信息中,我发现异常似乎是在调用另一个函数期间抛出的。
I had this strange problem with stack underflow errors happen only in the release build of Flex Builder project. I looked around the web to find a solution, but while I found some related posts, nothing really helped my out. So here is this question and my solution in the answers so that it may hopefully help other people.
The Problem: I ported a java program (a game) to flex and it works fine in debug mode on Android, the web and Playbook. However, when I build a release version of the game, it crashes. The error reported is 1024, i.e. stack underflow, according to Adobe's documentation.
At first, I thought the problem was limited only to the Playbook, but no, the exact same problem happens at the exact same place on the web browser and Android. From the debugging information I inserted, I discovered that the exception appears to be thrown during the call to another function.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
为了解决这个问题,我将有问题的函数分解为许多单独的函数,从而缩小了导致问题的代码的精确部分。这导致我找到几行代码,其中包含以下调用(在 try-catch 中):
嗯,这显然是由我用来从 Java 重构为 Actionscript 的正则表达式生成的。删除多余的 () 即可解决问题。
这是我希望编译器能够捕获的事情,而不是让它仅在发布时失败,即当包含违规代码的函数被推入堆栈时。
To solve the problem, I broke down the offending function in many individual functions and so narrowed down which precise part of the code what causing problem. This lead me to a few lines of code that had the following call (in a try-catch):
Hummm, this apparently was produced by the regex I used to refactor from Java to Actionscript. Removing the extra () solve the problem.
This is the kind of things I wished the compiler would catch instead of letting it fail only at release, when the function containing the offending code is pushed on the stack.