Apparently the sim doesn't like my script having a string containing a few gigabytes worth of characters.
It's currently possible for a variable within an event to contain apparently unlimited data.
The memory hack used frequently under LSL2:
some_string = (some_string = "") + some_string
breaks script memory limits, but only outside of loops. That's why all the same work can't be done in the while loop in the test script.
Memory limitation is working correctly for global strings so far. Within a single event, though, using the above hack breaks limitations.
Test script:
default {
state_entry() {
string test = " ";
integer i = 16384;
while ((i = i >> 1)) {
test = (test = "") + test + test;
}
test = llGetSubString((test = "") + test, 0, 9999);
test = (test = "") + test + test + test + test + test + test + test + test + test + test;
test = (test = "") + test + test + test + test + test + test + test + test + test + test;
test = (test = "") + test + test + test + test + test + test + test + test + test + test;
test = (test = "") + test + test + test + test + test + test + test + test + test + test;
// insert more as needed, this is already a 100000000 character string that halts the sim for a bit upon running
llOwnerSay((string)llStringLength((test = "") + test));
}
}
Error message (when adding more lines of string concatenation):
[9:47] Object: Script run-time error
[9:47] Object: System.OutOfMemoryException: Out of memory.
at (wrapper managed-to-native) System.String:InternalAllocateStr (int)
at System.String.Concat (System.String s1, System.String s2) [0x00000]
at LindenLab.SecondLife.LslUserScript.Add (System.String rhs, System.String lhs) [0x00000]
at LSL_05565a48_877b_591f_57a6_142407577826.defaultstate_entry () [0x00000]
at LSL_05565a48_877b_591f_57a6_142407577826defaultstate_entryFrame.ResumeVoid () [0x00000]
at LindenLab.SecondLife.UThread.UThread.Run () [0x00000]
at LindenLab.SecondLife.Script.Run (ScriptEvent evt) [0x00000]