0

This is a follow-up question on this; regarding the error message as below:

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

It basically says that the size of the code for the method _createPersistentElementsBP5_xjal() has exceeded the maximum limit. By inspecting the Java code of the model, I see that my main agent is divided into six parts: _createPersistentElementsBP1_xjal(), _createPersistentElementsBP2_xjal(),..., _createPersistentElementsBP6_xjal().

And the one with number 5 has issues. However, I cannot find any defined logic on how these methods are separated (e.g., what elements to include in which method).

If you look at the top part of the screenshot, you will see that paths 5,6,7 belong to ...BP4_xjal(). And then starts ...BP5_xjal() (the problematic one) with intersections and a node called reversePoint4. In fact, reversePoint4 and path5/6/7 all belong to the same network.

The question is: what is the basis for such method definitions in AnyLogic (e.g., which elements will belong to which method)? Is it done arbitrarily?

screenshot1

Dan
  • 3,647
  • 5
  • 20
  • 26
Yashar Ahmadov
  • 1,616
  • 2
  • 10
  • 21

2 Answers2

1

You can probably only know an answer to this by asking AnyLogic support since this is the internals of its code generation. My guess would be that it just splits the initialisation of space markup elements into 'chunks' of a given number (perhaps --- and this would be rather ironic --- to try to avoid method/signature size issues).

(I'm assuming that the BP1-5 splits don't correspond to any 'functional' splits in your model; e.g., different space markup networks or similar. You seem to be implying that in your question.)

Stuart Rossiter
  • 2,432
  • 1
  • 17
  • 20
0

Java has an in-built limit on the amount of text that can be used to define a single method (more explanation here). In this case, this error is caused by the actual text of the method is generated by AnyLogic.

To solve this I would try to restructure the model to reduce the amount of text. This can be done by defining functions that create elements instead of defining elements directly or moving elements inside other agents that are then included in Main agent.

Artem P.
  • 816
  • 1
  • 6
  • 8
  • 1
    See the question he's following up on which already covers this aspect (both possible refactoring and the limit which I'm pretty sure applies to the bytecode size, *not* the source text size). – Stuart Rossiter Nov 11 '21 at 15:25
  • Correct, I missed the original discussion. – Artem P. Nov 12 '21 at 01:04