# Gladys RAM usage

**URL:** <https://community.gladysassistant.com/t/gladys-utilisation-de-la-ram/7821>\
**Category:** Configuration\
**Created:** [January 7, 2023, 3:26pm UTC](https://community.gladysassistant.com/t/gladys-utilisation-de-la-ram/7821 "2023-01-07T15:26:18Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![spenceur](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/spenceur/32/1961_2.png) [@spenceur](https://community.gladysassistant.com/u/spenceur)\
**Post date:** [January 7, 2023, 3:26pm UTC](https://community.gladysassistant.com/t/gladys-utilisation-de-la-ram/7821/1 "2023-01-07T15:26:18Z")

</div>

Hello,

I’ve been watching this for a while but I notice that Gladys is using almost 12 GB of RAM  
I wanted to know whether this is normal or if there’s a real problem somewhere?

Gladys runs under Docker on my Synology NAS which has 20 GB of RAM.

 ![image](https://gladys-assistant-community.b-cdn.net/uploads/default/original/2X/f/ff33ac8e0d7f589f8728ecec22172e4b23032c72.png)

Thanks in advance 🙂

---

<div class="post-metadata">

**Author:** ![VonOx](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/vonox/32/10128_2.png) [@VonOx](https://community.gladysassistant.com/u/VonOx)\
**Post date:** [January 7, 2023, 4:31pm UTC](https://community.gladysassistant.com/t/gladys-utilisation-de-la-ram/7821/2 "2023-01-07T16:31:41Z")

</div>

I also confirm.

---

<div class="post-metadata">

**Author:** ![spenceur](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/spenceur/32/1961_2.png) [@spenceur](https://community.gladysassistant.com/u/spenceur)\
**Post date:** [January 7, 2023, 5:14pm UTC](https://community.gladysassistant.com/t/gladys-utilisation-de-la-ram/7821/3 "2023-01-07T17:14:04Z")

</div>

do you have the problem too then?  
or can you confirm that this isn’t normal 😃

---

<div class="post-metadata">

**Author:** ![VonOx](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/vonox/32/10128_2.png) [@VonOx](https://community.gladysassistant.com/u/VonOx)\
**Post date:** [January 7, 2023, 5:24pm UTC](https://community.gladysassistant.com/t/gladys-utilisation-de-la-ram/7821/4 "2023-01-07T17:24:50Z")

</div>

11 GB at my place

---

<div class="post-metadata">

**Author:** ![lmilcent](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/lmilcent/32/7023_2.png) [@lmilcent](https://community.gladysassistant.com/u/lmilcent)\
**Post date:** [January 7, 2023, 8:21pm UTC](https://community.gladysassistant.com/t/gladys-utilisation-de-la-ram/7821/5 "2023-01-07T20:21:15Z")

</div>

But that seems totally disproportionate to me! 😳  
On my machine, it doesn’t exceed 1 GiB of RAM.

---

<div class="post-metadata">

**Author:** ![spenceur](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/spenceur/32/1961_2.png) [@spenceur](https://community.gladysassistant.com/u/spenceur)\
**Post date:** [January 7, 2023, 8:58pm UTC](https://community.gladysassistant.com/t/gladys-utilisation-de-la-ram/7821/6 "2023-01-07T20:58:57Z")

</div>

Agreed — I don’t understand why Gladys is taking so long…

---

<div class="post-metadata">

**Author:** ![AlexTrovato](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/alextrovato/32/10705_2.png) [@AlexTrovato](https://community.gladysassistant.com/u/AlexTrovato)\
**Post date:** [January 7, 2023, 9:01pm UTC](https://community.gladysassistant.com/t/gladys-utilisation-de-la-ram/7821/7 "2023-01-07T21:01:42Z")

</div>

@spenceur @VonOx do you have 200,000 devices or users ?  
On va tenter de checker ce qui pourrait provoquer ça.

---

<div class="post-metadata">

**Author:** ![spenceur](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/spenceur/32/1961_2.png) [@spenceur](https://community.gladysassistant.com/u/spenceur)\
**Post date:** [January 7, 2023, 9:31pm UTC](https://community.gladysassistant.com/t/gladys-utilisation-de-la-ram/7821/8 "2023-01-07T21:31:31Z")

</div>

Ah ah

---

<div class="post-metadata">

**Author:** ![lmilcent](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/lmilcent/32/7023_2.png) [@lmilcent](https://community.gladysassistant.com/u/lmilcent)\
**Post date:** [January 8, 2023, 6:49am UTC](https://community.gladysassistant.com/t/gladys-utilisation-de-la-ram/7821/9 "2023-01-08T06:49:26Z")

</div>

The `top` or `htop` command lets you view running processes and their resource usage.

---

<div class="post-metadata">

**Author:** ![spenceur](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/spenceur/32/1961_2.png) [@spenceur](https://community.gladysassistant.com/u/spenceur)\
**Post date:** [January 8, 2023, 8:09am UTC](https://community.gladysassistant.com/t/gladys-utilisation-de-la-ram/7821/10 "2023-01-08T08:09:59Z")

</div>

Htop ne montre rien mais top me montre ceci

 ![Screenshot_20230108_090603_JuiceSSH](https://gladys-assistant-community.b-cdn.net/uploads/default/original/2X/7/78be598caf9b666087fba0a1f1d9b1cd86229aec.jpeg)

I should point out that I only have one camera ^^’

---

<div class="post-metadata">

**Author:** ![lmilcent](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/lmilcent/32/7023_2.png) [@lmilcent](https://community.gladysassistant.com/u/lmilcent)\
**Post date:** [January 8, 2023, 12:34pm UTC](https://community.gladysassistant.com/t/gladys-utilisation-de-la-ram/7821/11 "2023-01-08T12:34:51Z")

</div>

Here’s what it looks like without a camera for me.

 ![Screenshot_20230108-133408](https://gladys-assistant-community.b-cdn.net/uploads/default/original/2X/9/970a68214230922a5e2235b96808a08c51e90f5e.png)

---

<div class="post-metadata">

**Author:** ![lmilcent](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/lmilcent/32/7023_2.png) [@lmilcent](https://community.gladysassistant.com/u/lmilcent)\
**Post date:** [January 8, 2023, 12:35pm UTC](https://community.gladysassistant.com/t/gladys-utilisation-de-la-ram/7821/12 "2023-01-08T12:35:39Z")

</div>

Do you have the rest of the lines without ffmpeg?

---

<div class="post-metadata">

**Author:** ![lmilcent](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/lmilcent/32/7023_2.png) [@lmilcent](https://community.gladysassistant.com/u/lmilcent)\
**Post date:** [January 8, 2023, 12:38pm UTC](https://community.gladysassistant.com/t/gladys-utilisation-de-la-ram/7821/13 "2023-01-08T12:38:42Z")

</div>

You can run `top -b -n 1 -H` and copy all the lines.  
That runs top in batch mode, just once.

 ![Screenshot_20230108-144146](https://gladys-assistant-community.b-cdn.net/uploads/default/original/2X/8/80379c77da4c588972b417ff0a6b04ccb762ee05.png)

---

<div class="post-metadata">

**Author:** ![spenceur](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/spenceur/32/1961_2.png) [@spenceur](https://community.gladysassistant.com/u/spenceur)\
**Post date:** [January 8, 2023, 7:02pm UTC](https://community.gladysassistant.com/t/gladys-utilisation-de-la-ram/7821/14 "2023-01-08T19:02:55Z")

</div>

Sorry for the late reply 🙂

```auto
DiskStation:~$ sudo docker exec -it d7e940abe7b2 top -b -n 1 -H
Password:
Mem: 20013216K used, 315520K free, 178668K shrd, 267568K buff, 5973012K cached
CPU: 5% usr 11% sys 0% nic 83% idle 0% io 0% irq 0% sirq
Load average: 1.83 3.86 3.78 2/3317 22026
  PID PPID USER STAT VSZ %VSZ CPU %CPU COMMAND
22021 0 root R 1712 0% 2 8% top -b -n 1 -H
   27 20 root S 20.5g 103% 1 0% node index.js
   30 20 root S 20.5g 103% 3 0% node index.js
   32 20 root S 20.5g 103% 3 0% node index.js
   31 20 root S 20.5g 103% 0 0% node index.js
   29 20 root S 20.5g 103% 0 0% node index.js
   36 20 root S 20.5g 103% 1 0% node index.js
   34 20 root S 20.5g 103% 0 0% node index.js
   35 20 root S 20.5g 103% 1 0% node index.js
   37 20 root S 20.5g 103% 0 0% node index.js
   33 20 root S 20.5g 103% 1 0% node index.js
   28 20 root S 20.5g 103% 3 0% node index.js
    1 0 root S 313m 2% 3 0% npm run start:prod
   14 0 root S 313m 2% 3 0% {node} npm run start:prod
   11 0 root S 313m 2% 1 0% {node} npm run start:prod
   12 0 root S 313m 2% 0 0% {node} npm run start:prod
   13 0 root S 313m 2% 1 0% {node} npm run start:prod
   19 0 root S 313m 2% 3 0% npm run start:prod
   18 0 root S 313m 2% 3 0% npm run start:prod
   15 0 root S 313m 2% 0 0% {node} npm run start:prod
   16 0 root S 313m 2% 3 0% npm run start:prod
   10 0 root S 313m 2% 2 0% {node} npm run start:prod
   17 0 root S 313m 2% 3 0% npm run start:prod
   20 1 root S 257m 1% 3 0% node /src/server/node_modules/.bin/cross-env NODE_ENV=production node index.js
   25 1 root S 257m 1% 3 0% node /src/server/node_modules/.bin/cross-env NODE_ENV=production node index.js
   24 1 root S 257m 1% 3 0% node /src/server/node_modules/.bin/cross-env NODE_ENV=production node index.js
   26 1 root S 257m 1% 1 0% node /src/server/node_modules/.bin/cross-env NODE_ENV=production node index.js
   21 1 root S 257m 1% 1 0% node /src/server/node_modules/.bin/cross-env NODE_ENV=production node index.js
   22 1 root S 257m 1% 3 0% node /src/server/node_modules/.bin/cross-env NODE_ENV=production node index.js
   23 1 root S 257m 1% 3 0% node /src/server/node_modules/.bin/cross-env NODE_ENV=production node index.js

```

I removed the lines related to the camera

Thanks for the command

---

<div class="post-metadata">

**Author:** ![lmilcent](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/lmilcent/32/7023_2.png) [@lmilcent](https://community.gladysassistant.com/u/lmilcent)\
**Post date:** [January 8, 2023, 7:17pm UTC](https://community.gladysassistant.com/t/gladys-utilisation-de-la-ram/7821/15 "2023-01-08T19:17:36Z")

</div>

What bothers me is that this utility seems to display only the virtual memory used.

Let’s try something else. This command installs a more graphical and advanced version of `top` (to be run in your Gladys container).

`apk add -u htop ; htop -s PERCENT_MEM --tree --readonly`

Here’s what it looks like on my system:

 ![Screenshot_20230108-201601](https://gladys-assistant-community.b-cdn.net/uploads/default/original/2X/d/d21bae9b3c8c3aa96a95e72fa90a45e3f99483ea.png)

---

<div class="post-metadata">

**Author:** ![lmilcent](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/lmilcent/32/7023_2.png) [@lmilcent](https://community.gladysassistant.com/u/lmilcent)\
**Post date:** [January 8, 2023, 7:30pm UTC](https://community.gladysassistant.com/t/gladys-utilisation-de-la-ram/7821/16 "2023-01-08T19:30:22Z")

</div>

I just tested a much clearer command.

1. Connect to the Gladys container
2. Run `node --expose-gc`
3. Paste the following code ([source](https://stackoverflow.com/a/64550489))

```auto
const formatMemoryUsage = (data) =\u003e `${Math.round(data / 1024 / 1024 * 100) / 100} MB`;

const memoryData = process.memoryUsage();

const memoryUsage = {
  rss: `${formatMemoryUsage(memoryData.rss)} -\u003e Resident Set Size - total memory allocated for the process execution`,
  heapTotal: `${formatMemoryUsage(memoryData.heapTotal)} -\u003e total size of the allocated heap`,
  heapUsed: `${formatMemoryUsage(memoryData.heapUsed)} -\u003e actual memory used during the execution`,
  external: `${formatMemoryUsage(memoryData.external)} -\u003e V8 external memory`,
};

console.log(memoryUsage);

```

Result :

 ![Screenshot_20230108-202735_JuiceSSH](https://gladys-assistant-community.b-cdn.net/uploads/default/original/2X/e/e350e66b26b6fddcd77fb240532e5f7b1e538962.jpeg)

Now I’m not sure this takes Gladys processes into account, to be confirmed with your feedback.

---

<div class="post-metadata">

**Author:** ![spenceur](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/spenceur/32/1961_2.png) [@spenceur](https://community.gladysassistant.com/u/spenceur)\
**Post date:** [January 8, 2023, 8:29pm UTC](https://community.gladysassistant.com/t/gladys-utilisation-de-la-ram/7821/17 "2023-01-08T20:29:24Z")

</div>

![Screenshot_20230108_212842_JuiceSSH](https://gladys-assistant-community.b-cdn.net/uploads/default/original/2X/0/025da57fa39899271bbd82a4a9e0d0e6255af0f8.jpeg)

Not sure 😃

And for htop

 ![Screenshot_20230108_213708_JuiceSSH](https://gladys-assistant-community.b-cdn.net/uploads/default/original/2X/9/95c611b9206aa9a549fbbf70ea3326c2fa006e81.jpeg)

---

<div class="post-metadata">

**Author:** ![lmilcent](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/lmilcent/32/7023_2.png) [@lmilcent](https://community.gladysassistant.com/u/lmilcent)\
**Post date:** [January 8, 2023, 10:17pm UTC](https://community.gladysassistant.com/t/gladys-utilisation-de-la-ram/7821/18 "2023-01-08T22:17:48Z")

</div>

On htop it doesn’t look like your instance is using more RAM than mine. Are you 100% sure that the RAM is being used mostly by Gladys and not by the services on your NAS?

For info, virtual memory has no link to physical memory according to a comment on Node.js’s GitHub.

---

<div class="post-metadata">

**Author:** ![spenceur](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/spenceur/32/1961_2.png) [@spenceur](https://community.gladysassistant.com/u/spenceur)\
**Post date:** [January 8, 2023, 10:52pm UTC](https://community.gladysassistant.com/t/gladys-utilisation-de-la-ram/7821/19 "2023-01-08T22:52:35Z")

</div>

What you see in the image above is the information from the Gladys container.

Not from the NAS 🙂

 ![Screenshot_20230108_235133_Chrome](https://gladys-assistant-community.b-cdn.net/uploads/default/original/2X/4/4f42a16b7d77331b438f24f1dac55fa30cef569b.jpeg)

---

<div class="post-metadata">

**Author:** ![spenceur](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/spenceur/32/1961_2.png) [@spenceur](https://community.gladysassistant.com/u/spenceur)\
**Post date:** [January 9, 2023, 8:57pm UTC](https://community.gladysassistant.com/t/gladys-utilisation-de-la-ram/7821/20 "2023-01-09T20:57:50Z")

</div>

So any ideas? @lmilcent, @pierre-gilles  
:S

[Next page](https://community.gladysassistant.com/t/gladys-utilisation-de-la-ram/7821.md?page=2)
