Memory

Moduleejs.sys
Definition class Memory
InheritanceMemory inherit Object
Specifiedejscript-1.1
StabilityEvolving.

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


Properties

QualifiersPropertyTypeDescription
public static get setallocatedNumberTotal 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.
public static get setmaximumNumberMaximum 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.
public static get peakNumberPeak memory ever used by the application in bytes. This statistic is the maximum value ever attained by allocated.
public static get setredlineNumberMemory 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.
public 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.
public static get stackNumberPeak stack size ever used by the application in bytes.
public static get systemNumberSystem RAM. This is the total amount of RAM installed in the system in bytes.

Memory Methods

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

Method Detail

static public stats(): Void

Prints memory statistics to stdout.

Description
This is primarily used during development for performance measurement.