Difference between revisions of "LlGetSPMaxMemory"

From Second Life Wiki
Jump to navigation Jump to search
m (<lsl> tag to <source>)
 
(7 intermediate revisions by 6 users not shown)
Line 1: Line 1:
{{LSL_Function
{{LSL_Function
|func_id=???|func_sleep=0.0|func_energy=???
|func_id=???|func_sleep=0.0|func_energy=???
|func=LlGetSPMaxMemory
|func=llGetSPMaxMemory
|return_type=integer
|return_type=integer
|func_desc
|func_desc
Line 11: Line 11:
===Mono===
===Mono===


During and after a [[LlScriptProfiler]] profiling run, llGetSPMaxMemory will return the most memory used at any one time.
During and after a [[LlScriptProfiler]] profiling run, llGetSPMaxMemory will return the most memory used during profiling.


=== LSO ===
=== LSO ===


This function has no effect for scripts not compiled to Mono. It will always return 16384, the fixed LSO memory size.
This function has no effect for scripts not compiled to Mono. It will always return 16384, the fixed LSO memory size.
|caveats=
|caveats
*The number of free bytes the Heap can use may be greater but not less.
|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=
{{LSL DefineRow||[[llGetFreeMemory]]|}}
{{LSL DefineRow||[[llGetFreeMemory]]|}}
{{LSL DefineRow||[[llGetUsedMemory]]|}}
{{LSL DefineRow||[[llGetUsedMemory]]|}}
{{LSL DefineRow||[[llGetMemoryLimit]]|}}
{{LSL DefineRow||[[llSetMemoryLimit]]|}}
|also_events
|also_events
|also_tests
|also_tests
Line 30: Line 55:
|lso
|lso
|cat1=Script
|cat1=Script
|cat2
|cat2=Memory
|cat3
|cat3=Script Profiler
|cat4
|cat4
|history = Date of Release  [[ Release_Notes/Second_Life_Server/11#11.06.17.233176 | 17/06/2011 ]]
}}
}}

Latest revision as of 01:53, 22 January 2015

Summary

Function: integer llGetSPMaxMemory( );

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

Deep Notes

History

Date of Release 17/06/2011

Signature

function integer llGetSPMaxMemory();