← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #676495]: SikuliX: Jython: What limits script size?

 

Question #676495 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/676495

Summary changed to:
SikuliX: Jython: What limits script size?

Description changed to:
----------------------------------------------- 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 )

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.