# llGetMemoryLimit

*LSL function*

```lsl
integer integer llGetMemoryLimit();
```

- Returns: `integer`
- Energy: 10

Returns an integer representing the maximum memory limit (in bytes) that the script is allowed to allocate.

Get the maximum memory a script can use.

```lsl title="How to use" frame="terminal"
integer result = llGetMemoryLimit();
```

## Specification

;Mono:Gets the memory limit for the script.

- The memory limit can be up to 64k.
- The default memory limit is 64k[^wiki-3e6526].
- The memory limit is not the amount of real memory actually used by the script, just the upper limit on how much it could use.

;LSO:LSO scripts will always use exactly 16k

[^wiki-3e6526]: Prior to scripts being able to set their own limit, the limit was set to 64k

## Examples

<details open>
<summary>Example 1</summary>

```lsl
default
{
    state_entry()
    {
        llSetMemoryLimit( 4000 ); // set the memory limit

        // display memory usage...
        llSay(0, "Memory used: " + (string)llGetFreeMemory() + " bytes, total memory: " +
            (string)llGetMemoryLimit() + " bytes." );
    }
}

// outputs
// Object: Memory used: 124 bytes, total memory: 4000 bytes.
```

</details>

## History

Date of Release [10/08/2011](https://wiki.secondlife.com/wiki/Release_Notes/Second_Life_Server/11#11-08-10-238207)

## See also

### Functions

- [llSetMemoryLimit](/functions/llSetMemoryLimit/)
- [llGetFreeMemory](/functions/llGetFreeMemory/)
- [llGetUsedMemory](/functions/llGetUsedMemory/)
- [llGetObjectDetails](/functions/llGetObjectDetails/)

---

*Source: [LlGetMemoryLimit](https://wiki.secondlife.com/wiki/LlGetMemoryLimit) on the Second Life Wiki. Content from the Second Life Wiki article LlGetMemoryLimit (revision 1194206, 2015-01-22), CC BY-SA 3.0.*

---

From lsl.dev: https://lsl.dev/functions/llGetMemoryLimit/
