'My JavaScript code is memory leaking, but I don't know how to fix

I have a Discord bot written in Nodejs (JavaScript), but I run into a memory leak issue recently.

My code is using ~10GB memory, and it keep increasing. I run process.memUsage() and it returned something like this:

rss: ~10GB
heapTotal: ~300MB
heapUsed: ~250MB
external: ~500MB
arrayBuffer: ~500MB

I can't figure out which piece of code is leaking, there is alot tool that will diagnose memory leak in Node.js, but almost all tools is watching heap instead rss.

Note: I did not use any var keyword, I hate it.

Code repository: https://github.com/blackcatbot/blackcat



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source