AnyLogic内存错误:如何知道超过了多少阈值? [英] AnyLogic memory error: how to know how much the threshold is exceeded?

查看:145
本文介绍了AnyLogic内存错误:如何知道超过了多少阈值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的主要代理中有很多道路交通和标记元素、图表、节点和弧线.运行模拟时,它会引发以下错误:

I have a lot of road traffic and markup elements, charts, nodes and arcs within my Main agent. When running the simulation it throws the following error:

描述:方法_createPersistentElementsBP4_xjal()的代码超过了65535字节的限制.

Description: The code of method _createPersistentElementsBP4_xjal() is exceeding the 65535 bytes limit.

我阅读了这篇文章:https://noorjax.com/2018/10/17/your-agent-is-too-big-memory-problem/

但是,我想知道我超出了多少限制.有没有办法获得这些信息?因为如果它离阈值不远,我可以进行一些修改以低于该阈值.否则创建这么多新代理等很痛苦.

However, I would like to know how much have I exceeded the limit. Is there any way of getting this information? Because if it is not that far from the threshold, I can make some modifications to drop below that threshold. Otherwise it is painful to create so many new agents, etc.

推荐答案

这是 Java 虚拟机 (JVM) 对方法主体的 Java 字节码 大小(即编译后的代码大小)的限制)据我所知(例如,请参阅 Baeldung 的描述,其中链接到相关的 JVM 规范细节).因此,即使您可以看到为违规方法生成的 Java 代码,但实际上 那个 的长度并不是限制(尽管很明显源代码在某种程度上与编译后的字节码大小相关).

This is a Java Virtual Machine (JVM) restriction on the Java bytecode size for the method body (i.e., the compiled code size) as I understand it (e.g., see Baeldung's description which links to the relevant JVM specification details). Thus, even though you can see the generated Java source code for the offending method, it isn't actually the length of that that is the limitation (though obviously the length of the source code correlates to some degree with the size of the compiled bytecode).

[因此,我很惊讶 Felipe 减少变量名称长度的想法是否有任何不同,因为它们没有像字节码那样显式存储...]

[As such, I'm surprised if Felipe's idea of reducing variable name lengths makes any difference since they're not stored explicitly like that in the bytecode...]

所以,不,你无法判断你已经超出了多少(除非我猜你实际上询问了编译的类文件并确切地知道你在做什么).即使是 AnyLogic 的代码生成导致"了问题,任何此类情况通常始终是您可以从面向对象(或数据结构)设计角度在模型.

So, no, you can't tell how much you've exceeded it by (unless I guess you actually interrogate compiled class files and know exactly what you're doing). Even though it is AnyLogic's code generation that is 'causing' the problem, any such situation will normally always be something that you could re-architect better (as with Felipe's example) from an object-oriented (or data structuring) design perspective in the model.

这篇关于AnyLogic内存错误:如何知道超过了多少阈值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆