SikuliX: Jython: What limits script size?

Asked by Mike

----------------------------------------------- discussion (RaiMan)

At least until Java 8 the maximum size of a bytecode file (result of a Java compile or in Jython the resulting Java bytecode after interpreting a script file to make it runnable in the JVM) is 64 KB. Not clear wether this also is still true for Java beyond version 9.

Usually you should get an error message, but it is also possible, that the JVM might simply crash.

Workarounds:
- keep scripts small (less than some hundred lines)
- move repeatable snippets to separate scripts as functions/classes and use import
- use SikuliX's runscript, to run small scripts one after the other or even in loops
- surely there are some more possible solutions (the net will help)

--------------------------------------------------------------------------------------------------------------------------------

Charliedaps raised this question:

I am under windows 7 and I created a file that contains 1500 lines.
It works perfectly but if I add lines, it does not work anymore.

He added

In fact, I do not have an error message but the coding does not start.
These are 160 line steps so it's a simple copy paste with just one or two changes and when I go beyond 1,500 lines, it does not start anymore.

A previous discussion included this:
--1. the limit of 64K for the file size of generated byte code in the Jython/Java environment is fixed with the current environment (Jython 2.5.2/Java 6).
--2. When reducing the file size by refactoring does not bring you under the limit, you have to split the file into smaller pieces. Which should not be very complicated with Sikuli's support for import.
If import for some reason is not suitable, you might try execfile().

However this situation generated an error message
Can you think of relevant limits to program size in SikuliX? Breaking a program into modules and then importing them surely still leaves you with the same size program once it starts?

(as an aside, I once took over a C#.net project being built by about 6 programmers. The main program was a monster 8000 lines. You won’t be surprised to hear by the time arrived, every time a bug was fixed, two more appeared )

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

--- Can you think of relevant limits to program size in SikuliX?
... there is no "limits to program size in SikuliX". Any existing limit is always given by the used scripting/programming language/environment.

--- Breaking a program into modules and then importing them surely still leaves you with the same size program once it starts
... No, not true.
The above discussed Java limit of 64 KB only restricts the size of one single bytecode file loaded for whatever reason.

Can you help with this problem?

Provide an answer of your own, or ask Mike for more information if necessary.

To post a message you must log in.