Skip to content
lsl.devlsl.devLSL Dev

Script memory and limits

From the wiki’s script memory page: “All scripts in LSL pre-MONO start out with 16 kilobytes of memory. Mono scripts start with 64 kilobytes, this may be reduced with llSetMemoryLimit(). Additionally, Mono scripts only use the amount of real memory that they currently need, not the amount allocated to them”. The same page warns that “the data below may not be 100% accurate”.

  • llGetUsedMemory returns an integer “of the number of bytes of memory currently in use by the script.”
  • llGetFreeMemory returns an integer “of the number of free bytes of memory the script can use.” Note: “The amount of free memory is updated only at the start of a server frame, meaning the values from this function can fluctuate.”
  • llSetMemoryLimit: “Request limit bytes to be reserved for this script.” In Mono, “The memory limit can be set up to 64k.” and “The memory limit can not be set lower than the memory currently in use by the script.”

Running out of memory crashes the script with a Stack-Heap Collision.

Quotations are from the Second Life Wiki pages LSL Script Memory (revision 1205456, 2017-04-05), LlGetUsedMemory (revision 1218635, 2026-02-18), LlGetFreeMemory (revision 1218634, 2026-02-18) and LlSetMemoryLimit (revision 1194459, 2015-01-22); history, by Second Life Wiki contributors, under CC BY-SA 3.0. Last wiki edit: .