Skip to content
lsl.devlsl.devLSL Dev

llGetSPMaxMemory

function
Function syntax
integer llGetSPMaxMemory();
Returns
integer
Energy
10

Returns an integer representing the maximum memory (in bytes) used by the script while the memory profiler was last active (only valid after using PROFILE_SCRIPT_MEMORY).

How to use
integer result = llGetSPMaxMemory();

This function’s behavior is dependent upon the VM the script is using. Mono is the new VM, LSO is the old VM. The big difference between between Mono and LSO is that Mono scripts run faster and can utilize four times more memory.

During and after a LlScriptProfiler profiling run, llGetSPMaxMemory will return the most memory used during profiling.

This function has no effect for scripts not compiled to Mono. It will always return 16384, the fixed LSO memory size.

Example 1
16 collapsed lines
// need to run something for the profile to register...
ScriptRotate()
{
llTargetOmega(<0.5, 0.7, 0.2>, 0.75, 0.75);
}
default
{
state_entry()
{
llSetMemoryLimit( 5000 ); // set the memory limit
// call up the profiler, execute a method, stop profiler
llScriptProfiler( PROFILE_SCRIPT_MEMORY );
ScriptRotate();
llScriptProfiler( PROFILE_NONE );
// display memory usage...
llSay(0, "Memory used: " + (string)llGetSPMaxMemory() + " bytes, total memory: " +
(string)llGetMemoryLimit() + " bytes." );
}
}
// outputs
// Object: Memory used: 4448 bytes, total memory: 5000 bytes.

Date of Release 17/06/2011

Original wiki source

Some wiki templates and tables need their original context. View this article on the Second Life Wiki. Technical wording and examples are retained from the source; historical guidance may differ from current behavior.

From the Second Life Wiki

Community documentation adapted from LlGetSPMaxMemory, by Linden Research, Inc. and contributing residents.View contributors and history.

Imported wiki revision:

Licensed under CC BY-SA 3.0. Last wiki edit: .Formatting and links have been adapted for this site; API metadata follows the LSL definitions.