Difference between revisions of "LlGetSPMaxMemory"
Jump to navigation
Jump to search
m (added date of release) |
m (<lsl> tag to <source>) |
||
(One intermediate revision by one other user not shown) | |||
Line 18: | Line 18: | ||
|caveats | |caveats | ||
|constants | |constants | ||
|examples | |examples=<source lang="lsl2">// 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.</source> | |||
|helpers | |helpers | ||
|also_functions= | |also_functions= |
Latest revision as of 01:53, 22 January 2015
LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials |
Summary
Function: integer llGetSPMaxMemory( );0.0 | Forced Delay |
??? | Energy |
Returns the integer of the most bytes used while LlScriptProfiler was last active.
Specification
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.
Mono
During and after a LlScriptProfiler profiling run, llGetSPMaxMemory will return the most memory used during profiling.
LSO
This function has no effect for scripts not compiled to Mono. It will always return 16384, the fixed LSO memory size.
Examples
// 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.
See Also
Functions
• | llGetFreeMemory | |||
• | llGetUsedMemory | |||
• | llGetMemoryLimit | |||
• | llSetMemoryLimit |