Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0007838opensim[REGION] Script Functionspublic2016-03-07 01:582020-11-19 09:58
ReporterBob Wellman 
Assigned Totampa 
StatusresolvedResolutionno change required 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0007838: osGetSimulatorMemory does not work over 2gb
DescriptionI have simulator instances using > 2gb of memory. When I use this command it caps the result at 2gb (2147483647 bytes to be precise).

I believe this is because the returned value from the function is integer and this is the maximum a signed integer can hold.

I think the least disruptive way to fix this would be to still return an integer result but allow the function to receive an optional parameter to request scaling of the result (rounded).

So old scripts would remain unchanged and work as before and for larger simulators we could code as follows;

integer scale=1024;
integer TotMemUsed = osGetSimulatorMemory(scale);

This would return an answer in KBytes (to the nearest KByte). When usage memory is this high we don't need byte accuracy imho.
Steps To ReproducePlace the following script in a prim where the simulator is using >2gb of memory.

// Simple Unformatted Output
integer TotMemUsed;
 TotMemUsed = osGetSimulatorMemory();
 llSetText( (string)TotMemUsed+" Memory by the OpenSimulator Instance", <0.0,1.0,0.0>, 1.0 );
 touch(integer num)
 TotMemUsed = osGetSimulatorMemory();
 llSetText( (string)TotMemUsed+" Memory by the OpenSimulator Instance", <0.0,1.0,0.0>, 1.0 );
TagsNo tags attached.
Git Revision or version number
Run Mode Grid (Multiple Regions per Sim)
Physics EngineBulletSim
Script Engine
EnvironmentMono / Linux64
Mono VersionNone
Attached Files

- Relationships

-  Notes
zadark (reporter)
2016-03-22 10:53
edited on: 2016-03-22 13:06

Inspecting osGetSimulatorMemory implementation it appears that the function design is specific to 32 bit systems.

***Edit: As per discussion on IRC LSL ints are signed 32 bit, rendering this function less than useful on systems above 32 bit.

if (pws > Int32.MaxValue)
    return Int32.MaxValue;
if (pws < 0)
     return 0;

Not sure what is expected of the output which is the return value from:
(see) [^]

zadark (reporter)
2016-03-22 13:08

***Edit: As per discussion on IRC LSL ints are signed 32 bit, rendering this function less than useful on systems above 32 bit.
tampa (reporter)
2020-11-19 09:58

Use osGetSimulatorMemoryKB instead

- Issue History
Date Modified Username Field Change
2016-03-07 01:58 Bob Wellman New Issue
2016-03-22 10:53 zadark Note Added: 0030093
2016-03-22 13:06 zadark Note Edited: 0030093 View Revisions
2016-03-22 13:08 zadark Note Added: 0030095
2020-11-19 09:58 tampa Note Added: 0037214
2020-11-19 09:58 tampa Status new => resolved
2020-11-19 09:58 tampa Resolution open => no change required
2020-11-19 09:58 tampa Assigned To => tampa

Copyright © 2000 - 2012 MantisBT Group
Powered by Mantis Bugtracker