State
The Game script module compiles without any error, then the process crashes during startup:
SCRIPT (E): Virtual Machine Exception
Reason: NULL pointer to instance
Function: '#InitGlobals'
Stack trace:
Scripts/Game/UI/HUD/AvailableActions/Conditions/Game/Character/SCR_CharacterHasGadgetInHandCondition.c:9 Function #InitGlobals
ENGINE (F): CrashedSometimes the reason is Access violation. Illegal read by 0x... at 0x0 with the same stack trace.
The reported file is unrelated: line 9 of SCR_CharacterHasGadgetInHandCondition.c is a plain method body (return GetReturnResult(data.GetHeldGadget() != null);), not a static initializer. The crash location does not depend on which mods are loaded.
It reproduces on the vanilla game with a single small addon that contains only unused script classes. No mod, no world, no config is needed.
Attached: Reforger_script_limit_repro.zip (4 tiny addons, scripts only).
Unzip into a folder, for example C:\repro.
Run: ArmaReforgerServer.exe -profile C:\repro\profile -addonsDir C:\repro -addons 5245505246000002 -noThrow
The server compiles the Game module ("Module: Game; loaded ...") and crashes about 5 seconds later with the stack trace above.
Run the same command with -addons 5245505246000001: the server starts normally.
AddonGUIDContentResultRepro_Functions_OK52455052460000015,500 classes, each with 10 small methods called oncestartsRepro_Functions_Crash52455052460000027,500 identical classescrashRepro_Generics_OK52455052470000014,300 classes class X { ref array<ref X> m_a; }startsRepro_Generics_Crash52455052470000025,000 identical classescrash
None of these classes is ever instantiated and none of the code is ever executed.
The crash appears when a count inside the Game module passes a fixed threshold. What adds to that count:
Each non-empty script function that is called at least once from script. On vanilla 1.9.0.37 the threshold is between 60,000 and 65,000 additional such functions.
Each new generic instantiation. One array<ref T> for a new T costs about as much as 14 functions (threshold between 4,560 and 4,565 new types). array<T> without ref costs nothing until a method is used on it, then roughly 6 functions plus 1 per method used.
What does not add to it, even in very large numbers:
empty functions (200,000 tested), and non-empty functions that no script calls (160,000 tested)
classes, enums, member variables, local variables, constants, string literals
the length of function bodies (5.6 million simple statements tested)
call sites: 500,000 calls to the same function are free, only distinct callees count
The count is per script module. The same probe placed in Scripts/GameLib does not affect the Game module, and a call from Game code to a GameLib function still counts for Game.
The numbers suggest a 16-bit index somewhere in the function or call-target tables of a script module, but that is a guess.
The vanilla game leaves room for about 4,560 "units" (one unit = one array<ref T> instantiation, about 14 functions). A typical large script mod uses 200 to 350 of them:
AddonCostRealistic Drone Warfare 3.1.2325A 20,000-line vehicle mod210A 4,700-line gameplay mod35
A server with about 125 popular mods has less than 300 units left. Adding one more script mod, or a routine update of existing mods, makes the server crash at startup. Nothing in the log points to the cause, and the compile step reports no error, so server owners cannot diagnose it.
Either no fixed limit, or a clear compile-time error that names the limit and the current count, as "Too many instructions per function" does.
An addon that overrides vanilla script files of unused subsystems (tutorial, Capture & Hold, cinematics, main menu screens) with empty function bodies. It frees about 340 units. It has to be regenerated after every game update.
Activity
You are not signed in. Please sign in to see more details and to reply.
State