Memory
Module | ejs |
Definition | class Memory |
Inheritance | Memory Object |
Specified | ejscript-2.5 |
Stability | Evolving. |
Singleton class to monitor and report on memory allocation and using.
Properties
Qualifiers | Property | Type | Description |
static get | 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. |
static get set | callback | Void | Memory 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 | 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. By default, maximum is set to unlimited.
8. |
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. |
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.
NOTE: this is currently reporting the peak resident memory and not the current resident memory. |
static get | system | Number | System RAM. This is the total amount of RAM installed in the system in bytes. |
Inherited Properties
Memory Class Methods
Qualifiers | Method |
static | stats(): Void |
| Prints memory statistics to stdout. |
Inherited Methods
Memory Instance Methods
Qualifiers | Method |
(No own instance methods defined)
Inherited Methods
Method Detail
- Description
- Prints memory statistics to stdout. This is primarily used during development for performance measurement.