getMemoryUsage()
getMemoryUsage()
getMemoryUsage()
Overview
The getMemoryUsage()
function retrieves the current memory usage of the system. It calculates the percentage of active memory relative to the total available memory and returns it as a percentage value rounded to two decimal places.
Usage
Description
getMemoryUsage()
fetch memory stats.It calculates the percentage of active memory by dividing the active memory by the total memory and multiplying by 100.
The result is returned as a string with two decimal places, representing the percentage of memory usage.
This function is asynchronous, so it returns a promise and should be used with
await
.
Use this function to monitor the memory usage in real-time or log memory statistics in your application.
Last updated