Difference between revisions of "LlGetFreeMemory"

From Second Life Wiki
Jump to navigation Jump to search
Line 3: Line 3:
|func=llGetFreeMemory|sort=GetFreeMemory
|func=llGetFreeMemory|sort=GetFreeMemory
|return_type=integer
|return_type=integer
|func_footnote
|func_footnote='''BUG:''' Instead of returning the free space it returns the amount of free space that has ''never'' been allocated by the heap (historic lowest heap pointer minus the stack end pointer). This means that the heap will appear to never shrink in size (when in fact it does grow and shrink to fill the free space).
|func_desc
|func_desc
|return_text=that is the historic available heap space for the current script.
|return_text=that is the available free space for the current script.
|spec
|spec
|caveats=*The function will NEVER return a higher number than any previous call to itself.
|caveats=*The function will NEVER return a higher number than any previous call to itself.

Revision as of 17:43, 16 April 2007

Summary

Function: integer llGetFreeMemory( );

Returns an integer that is the available free space for the current script.

BUG: Instead of returning the free space it returns the amount of free space that has never been allocated by the heap (historic lowest heap pointer minus the stack end pointer). This means that the heap will appear to never shrink in size (when in fact it does grow and shrink to fill the free space).

Caveats

  • The function will NEVER return a higher number than any previous call to itself.
All Issues ~ Search JIRA for related Bugs

Examples

// To show usage of memory by a script, take the free memory from 16k
llOwnerSay("Script uses " + (string)((16384 - llGetFreeMemory())/1024) + " kBytes");

Notes

Because of the implementation of this function it's usefulness is limited. It has been stated that when the LSL VM is moved to Mono that this function will work properly.

Deep Notes

Search JIRA for related Issues

Signature

function integer llGetFreeMemory();