> For the complete documentation index, see [llms.txt](https://sheita.gitbook.io/sysmonitoring/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sheita.gitbook.io/sysmonitoring/functions/getmemoryusage.md).

# 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

```js
const memoryUsage = await monitoring.getMemoryUsage();
```

### 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.
