Memory

Sansar.Script.Memory

Memory Class

The Memory class reports on script pool memory use.

Syntax

public class Memory : InstanceInterface

Remarks

Memory use is tracked by groups of scripts called "pools". There are two types of pools:

C# Example
              
  • Scene: The scripts attached to the scene and to objects built into the scene all share a pool that is allowed a large amount of memory.
  • Guests: Scripts associated with each visiting user share their own pool independent of other users. These pools are allowed a smaller amount of memory.

The Policy properties will reflect the use levels for the type of pool this script is associated with.

Requirements

Namespace: Sansar.Script
Assembly: Sansar.Script (in Sansar.Script.dll)
Assembly Versions: 1.0.0.0

Members

See Also: Inherited members from InstanceInterface.

Public Properties

[read-only]
 
ActivityLevel float . Current memory activity level since start of last memory counting.
[read-only]
 
IsValid bool . Whether or not this interface is valid. (Inherited from InstanceInterface.)
[read-only]
 
PeakUsedBytes uint . The highest level of memory used by the script pool.
[read-only]
 
PolicyCritical uint . Current policy Critical level of used memory by the script pool
[read-only]
 
PolicyLimit uint . Current policy Limit level of used memory by the script pool
[read-only]
 
PolicyWarning uint . Current policy Warning level of used memory by the script pool
[read-only]
 
UsedBytes uint . Total bytes used by this script pool as of last accounting.

Public Methods

  Subscribe (Memory.SubscriptionHandler, bool)
Subscribes to Memory Events.
  Subscribe (Action<MemoryData>, bool)
Subscribes to Memory Events.
override
ToString () : string
A string representation of this object.

Member Details

ActivityLevel Property

Current memory activity level since start of last memory counting.

Syntax

public float ActivityLevel { get; }

Value

uint

Remarks

Activity levels are 0-1: Low activity, 1-2: Medium activity, >2: High activity.

Requirements

Namespace: Sansar.Script
Assembly: Sansar.Script (in Sansar.Script.dll)
Assembly Versions: 1.0.0.0

PeakUsedBytes Property

The highest level of memory used by the script pool.

Syntax

public uint PeakUsedBytes { get; }

Value

uint

Remarks

The peak is reset when the server resets.

Requirements

Namespace: Sansar.Script
Assembly: Sansar.Script (in Sansar.Script.dll)
Assembly Versions: 1.0.0.0

PolicyCritical Property

Current policy Critical level of used memory by the script pool

Syntax

public uint PolicyCritical { get; }

Value

uint

Remarks

When the memory used in the pool passes this mark events will be sent to scripts subscribed to ScriptMemoryEvents and memory counting will become more frequent.

Requirements

Namespace: Sansar.Script
Assembly: Sansar.Script (in Sansar.Script.dll)
Assembly Versions: 1.0.0.0

PolicyLimit Property

Current policy Limit level of used memory by the script pool

Syntax

public uint PolicyLimit { get; }

Value

uint

Remarks

When the memory used in the pool passes this mark events will be sent to scripts subscribed to ScriptMemoryEvents. Script pools that stay above this limit may be stopped or removed from the scene.

Requirements

Namespace: Sansar.Script
Assembly: Sansar.Script (in Sansar.Script.dll)
Assembly Versions: 1.0.0.0

PolicyWarning Property

Current policy Warning level of used memory by the script pool

Syntax

public uint PolicyWarning { get; }

Value

uint

Remarks

When the memory used in the pool passes this mark events will be sent to scripts subscribed to ScriptMemoryEvents

Requirements

Namespace: Sansar.Script
Assembly: Sansar.Script (in Sansar.Script.dll)
Assembly Versions: 1.0.0.0

Subscribe Method

Subscribes to Memory Events.

Syntax

public void Subscribe (Memory.SubscriptionHandler callback, bool persistent)

Parameters

callback
Callback which is executed when the event completes.
persistent
Optional, set to false to unsubscribe after one event.

Remarks

 

Requirements

Namespace: Sansar.Script
Assembly: Sansar.Script (in Sansar.Script.dll)
Assembly Versions: 1.0.0.0

Subscribe Method

Subscribes to Memory Events.

Syntax

public void Subscribe (Action<MemoryData> callback, bool persistent)

Parameters

callback
Callback which is executed when the event completes.
persistent
Optional, set to false to unsubscribe after one event.

Remarks

 

Requirements

Namespace: Sansar.Script
Assembly: Sansar.Script (in Sansar.Script.dll)
Assembly Versions: 1.0.0.0

ToString Method

A string representation of this object.

Syntax

public override string ToString ()

Returns

A string representation of this object.

Remarks

The format of this string may change between releases.

Requirements

Namespace: Sansar.Script
Assembly: Sansar.Script (in Sansar.Script.dll)
Assembly Versions: 1.0.0.0

UsedBytes Property

Total bytes used by this script pool as of last accounting.

Syntax

public uint UsedBytes { get; }

Value

uint

Remarks

Memory is counted based on script activity in the scene across all pools. Memory.ActivityLevel

Requirements

Namespace: Sansar.Script
Assembly: Sansar.Script (in Sansar.Script.dll)
Assembly Versions: 1.0.0.0


Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

0 Comments

Article is closed for comments.