High memory use for "node" process (v4.3.0/v4.3.1)

I am a happy user of Peertube.

Recently I’ve noticed high memory use on my instance (v4.3.1, was the same on v4.3.0, haven’t checked on 3.*): the node process eats up about 13 GB, with ~185 MB resident, whereas the FAQ says that 500 MB should be enough.

The instance is a FreeBSD 12.3 VM (jail) running node 18.7.0 accessible at peertube.eu.org.

How can I check where this memory usage is coming from? Does anyone see similar figures?

I don’t host many videos (only a few personal videos) but the instance is federated with bigger instances.

See screenshot from top

Thanks for any advice in diagnosing the issue…

Update: tested v4.3.1 with node v14, similar result (20 GB instead of 13 GB).

Just checked on one of my instances.

peertube  20   0   21.8g 326224  16288 S   2.3   8.2 275:33.64 peertube 

Seems to be the same.
Don’t know why, but that should not be a problem. It is the virtual memory size, not the used memory (the server on which I looked as only 4Gb of RAM, and 2Gb or swap, and virtual memory size is 21.8G).

Virtual memory is not real :slight_smile: : Virtual memory - Wikipedia

1 Like

Thanks for the confirmation. :slight_smile:

I know what virtual memory is, and it doesn’t really change the issue :slightly_smiling_face:

Somehow node does a 13 GB allocation, I find such a large allocation surprising and I would like to know for what purpose. Potentially it might try to use it (if not, why does it allocate it) which would make it unavailable for other processes on the machine, or even cause the host to swap, which would hamper performance. I have other node processes (for Mastodon or other) which don’t exhibit the same behaviour.

I have found this page with gives some info on how to set memory limits. Running a node.js app in a low-memory environment

=> setting a limit of 1500 MB (–max_old_space_size=1500) doesn’t change anything, still 13 GB virtual size after startup.

Oops sorry Pierre, I didn’t see that it was you. I tried to be not too technical in my answer.

1 Like

:sweat_smile: no worry at all, thanks for taking the time :slight_smile:


You may want to ask your question directly to nodejs developers.

Thanks, before trying that I’m testing the various debug/configuration flags in nodejs.

I have found that starting with --jitless (which doesn’t work successfully every time) uses up much less memory:

Then after a few minutes it grew to 924MB but it’s much more reasonable than 13 GB.

So it looks like JIT might be the culprit.

Git issue opened here. Extremely high node18/node14 memory use (13-20 GB) when running Peertube, fixed by running with --jitless · Issue #45557 · nodejs/node · GitHub