# Script memory and limits

> How much memory an LSL script has, how to measure it, and the scripting limits.

:::caution[Stub]
This documentation page is a stub and is currently under development.
:::

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`](/functions/llGetUsedMemory/) returns an integer "of the number of bytes of memory currently in use by the script."
- [`llGetFreeMemory`](/functions/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`](/functions/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](/fundamentals/errors/).

## Reference

- [Scripting limits](/reference/limits/#scripting): memory size, source size, listeners
- [`llGetUsedMemory`](/functions/llGetUsedMemory/), [`llGetFreeMemory`](/functions/llGetFreeMemory/), [`llSetMemoryLimit`](/functions/llSetMemoryLimit/), [`llGetMemoryLimit`](/functions/llGetMemoryLimit/), [`llScriptProfiler`](/functions/llScriptProfiler/)
- [Errors](/fundamentals/errors/)

*Quotations are from the Second Life Wiki pages [LSL Script Memory](https://wiki.secondlife.com/wiki/LSL_Script_Memory), [LlGetUsedMemory](https://wiki.secondlife.com/wiki/LlGetUsedMemory), [LlGetFreeMemory](https://wiki.secondlife.com/wiki/LlGetFreeMemory), [LlSetMemoryLimit](https://wiki.secondlife.com/wiki/LlSetMemoryLimit), by Second Life Wiki contributors, under [CC BY-SA 3.0](https://creativecommons.org/licenses/by-sa/3.0/).*

---

From lsl.dev: https://lsl.dev/fundamentals/memory/
