Memory
Module | ejs.sys |
Definition | class Memory |
Inheritance | Memory ![]() |
Specified | ejscript-1.1 |
Stability | Evolving. |
Singleton class to monitor and report on memory allocation and usage.
Properties
Qualifiers | Property | Type | Description |
---|---|---|---|
public static get set | allocated | Number | Total 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 set | maximum | Number | Maximum 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 | peak | Number | Peak memory ever used by the application in bytes. This statistic is the maximum value ever attained by allocated. |
public static get set | redline | Number | Memory 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 | resident | Number | Application'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 | stack | Number | Peak stack size ever used by the application in bytes. |
public static get | system | Number | System RAM. This is the total amount of RAM installed in the system in bytes. |
Memory Methods
Qualifiers | Method |
---|---|
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.