1# MemoryManagement
2
3The `Napi::MemoryManagement` class contains functions that give the JavaScript engine
4an indication of the amount of externally allocated memory that is kept alive by
5JavaScript objects.
6
7## Methods
8
9### AdjustExternalMemory
10
11The function `AdjustExternalMemory` adjusts the amount of registered external
12memory used to give the JavaScript engine an indication of the amount of externally
13allocated memory that is kept alive by JavaScript objects.
14The JavaScript engine uses this to decide when to perform global garbage collections.
15Registering externally allocated memory will trigger global garbage collections
16more often than it would otherwise in an attempt to garbage collect the JavaScript
17objects that keep the externally allocated memory alive.
18
19```cpp
20static int64_t Napi::MemoryManagement::AdjustExternalMemory(Napi::Env env, int64_t change_in_bytes);
21```
22
23- `[in] env`: The environment in which the API is invoked under.
24- `[in] change_in_bytes`: The change in externally allocated memory that is kept
25alive by JavaScript objects expressed in bytes.
26
27Returns the adjusted memory value.
28