• All submissions to this site are governed by Second Life Project Contribution Agreement. By submitting patches and other information using this site, you acknowledge that you have read, understood, and agreed to those terms.
Issue Details (XML | Word | Printable)

Key: SVC-1353
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Showstopper Showstopper
Assignee: Unassigned
Reporter: Tyken Hightower
Votes: 1
Watchers: 2
Operations

If you were logged in you would be able to see more operations.
2. Second Life Service - SVC

Mono Beta: Broken Script Memory Constraints

Created: 30/Jan/08 10:13 AM   Updated: 12/Feb/08 12:27 PM
Return to search
Component/s: Scripts
Affects Version/s: Mono Beta
Fix Version/s: None

Issue Links:
Relates
 

Linden Lab Issue ID: DEV-9837
Linden Lab Internal Branch: mono-based-on-r78800


 Description  « Hide
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]



 All   Comments   Change History      Sort Order: Ascending order - Click to sort in descending order
Tyken Hightower added a comment - 30/Jan/08 10:21 AM
NOT a duplicate; memory limitation bugs are slightly different between strings and lists.

Tyken Hightower added a comment - 30/Jan/08 08:08 PM
Changed to critical, this easily crashes the sim 100% of the time when large concatenations are performed.

Strife Onizuka added a comment - 31/Jan/08 11:38 AM
IMHO it looks like we need a limit on the lengths of strings and have that check performed at string catenation.

Vektor Linden added a comment - 31/Jan/08 03:33 PM
LL Bug # DEV-9837

Babbage Linden added a comment - 01/Feb/08 04:36 AM
Added checks to list and string concatenation. The following scripts now all generate stack heap collision errors:

default
{
state_entry()

{ string s = "s"; s = s + s;//llSay(0, (string)llStringLength(s)); s = s + s;//llSay(0, (string)llStringLength(s)); s = s + s;//llSay(0, (string)llStringLength(s)); s = s + s;//llSay(0, (string)llStringLength(s)); s = s + s;//llSay(0, (string)llStringLength(s)); s = s + s;//llSay(0, (string)llStringLength(s)); s = s + s;//llSay(0, (string)llStringLength(s)); s = s + s;//llSay(0, (string)llStringLength(s)); s = s + s;//llSay(0, (string)llStringLength(s)); s = s + s;//llSay(0, (string)llStringLength(s)); s = s + s;//llSay(0, (string)llStringLength(s)); s = s + s;//llSay(0, (string)llStringLength(s)); s = s + s;//llSay(0, (string)llStringLength(s)); s = s + s;//llSay(0, (string)llStringLength(s)); s = s + s;//llSay(0, (string)llStringLength(s)); s = s + s; }

}

default
{
state_entry()

{ string s = "s"; s += s;//llSay(0, (string)llStringLength(s)); s += s;//llSay(0, (string)llStringLength(s)); s += s;//llSay(0, (string)llStringLength(s)); s += s;//llSay(0, (string)llStringLength(s)); s += s;//llSay(0, (string)llStringLength(s)); s += s;//llSay(0, (string)llStringLength(s)); s += s;//llSay(0, (string)llStringLength(s)); s += s;//llSay(0, (string)llStringLength(s)); s += s;//llSay(0, (string)llStringLength(s)); s += s;//llSay(0, (string)llStringLength(s)); s += s;//llSay(0, (string)llStringLength(s)); s += s;//llSay(0, (string)llStringLength(s)); s += s;//llSay(0, (string)llStringLength(s)); s += s;//llSay(0, (string)llStringLength(s)); s += s;//llSay(0, (string)llStringLength(s)); s += s; }

}

default
{
state_entry()

{ list l = ["l"]; l = l + l;//llSay(0, (string)llGetListLength(l)); l = l + l;//llSay(0, (string)llGetListLength(l)); l = l + l;//llSay(0, (string)llGetListLength(l)); l = l + l;//llSay(0, (string)llGetListLength(l)); l = l + l;//llSay(0, (string)llGetListLength(l)); l = l + l;//llSay(0, (string)llGetListLength(l)); l = l + l;//llSay(0, (string)llGetListLength(l)); l = l + l;//llSay(0, (string)llGetListLength(l)); l = l + l;//llSay(0, (string)llGetListLength(l)); l = l + l;//llSay(0, (string)llGetListLength(l)); l = l + l;//llSay(0, (string)llGetListLength(l)); l = l + l;//llSay(0, (string)llGetListLength(l)); l = l + l;//llSay(0, (string)llGetListLength(l)); l = l + l;//llSay(0, (string)llGetListLength(l)); l = l + l; }

}

default
{
state_entry()

{ list l = ["l"]; l += l;//llSay(0, (string)llGetListLength(l)); l += l;//llSay(0, (string)llGetListLength(l)); l += l;//llSay(0, (string)llGetListLength(l)); l += l;//llSay(0, (string)llGetListLength(l)); l += l;//llSay(0, (string)llGetListLength(l)); l += l;//llSay(0, (string)llGetListLength(l)); l += l;//llSay(0, (string)llGetListLength(l)); l += l;//llSay(0, (string)llGetListLength(l)); l += l;//llSay(0, (string)llGetListLength(l)); l += l;//llSay(0, (string)llGetListLength(l)); l += l;//llSay(0, (string)llGetListLength(l)); l += l;//llSay(0, (string)llGetListLength(l)); l += l;//llSay(0, (string)llGetListLength(l)); l += l;//llSay(0, (string)llGetListLength(l)); l += l; }

}