Memory

Moduleejs
Definition class Memory
InheritanceMemory inherit Object
Specifiedejscript-2.5
StabilityEvolving.

Singleton class to monitor and report on memory allocation and using.


Properties

QualifiersPropertyTypeDescription
static get allocatedNumberTotal heap memory currently allocated by the application in bytes. This includes memory currently in use and also memory that has been freed but is still retained by the application for future use. It does not include code, static data or stack memory. If you require these, use the resident call.
static get set callbackVoidMemory redline callback. When the memory redline limit is exceeded, the callback will be invoked. If no callback is defined and the redline limit is exceeded, a MemoryError exception is thrown. This callback enables the application detect low memory conditions before they become critical and to recover by freeing memory or to gracefully exit. While the callback is active subsequent invocations of the callback are suppressed. The callback is invoked with the following signature: function callback(size: Number, total: Number): Void.
static get set maximumNumberMaximum amount of heap memory the application may use in bytes. This defines the upper limit for heap memory usage by the entire hosting application. If this limit is reached, subsequent memory allocations will fail and a MemoryError exception will be thrown. Setting it to zero will allow unlimited memory allocations up to the system imposed maximum. If redline is defined and non-zero, the redline callback will be invoked when the redline is exceeded. By default, maximum is set to unlimited. 8.
static get set redlineNumberMemory redline value in bytes. When the memory redline limit is exceeded, the redline callback will be invoked. If no callback is defined, a MemoryError exception is thrown. The redline limit enables the application detect low memory conditions before they become critical and to recover by freeing memory or to gracefully exit. Note: the redline applies to the entire hosting application.
static get residentNumberApplication's current resident set in bytes. This is the total memory used to host the application and includes all the the application code, data and heap. It is measured by the O/S. NOTE: this is currently reporting the peak resident memory and not the current resident memory.
static get systemNumberSystem RAM. This is the total amount of RAM installed in the system in bytes.

Memory Class Methods

QualifiersMethod
static stats(): Void
 Prints memory statistics to stdout.

Memory Instance Methods

(No own instance methods defined)

QualifiersMethod

Method Detail

static stats(): Void
Description
Prints memory statistics to stdout. This is primarily used during development for performance measurement.