LSL: Memory Limits
Minimize a scripts memory usage
Every Mono script in Second Life uses 65536 bytes 1) if it needs it or not, this lets you reduce that amount
Uncomment the llOwnerSay
line to see how much memory is being used, then set MEM_LIMIT
to just above that. Some scripts will need additional memory while they run, if you get errors like “Stack heap collision” increase MEM_LIMIT
.
// Memory limit integer MEM_LIMIT = 65536; default { state_entry() { // Set up memory constraints llSetMemoryLimit(MEM_LIMIT); // Uncomment the next line in order to see how much memory your script is using // llOwnerSay("Memory: used="+(string)llGetUsedMemory()+" free="+(string)llGetFreeMemory()); } }