我的JavaScript代码是内存泄漏,但我不知道如何修复
我有一个用nodejs(JavaScript)编写的Discord机器人,但是最近我遇到了一个内存泄漏问题。
我的代码正在使用〜10GB内存,并且它不断增加。我运行process.memusage()
,它返回了这样的东西:
rss: ~10GB
heapTotal: ~300MB
heapUsed: ~250MB
external: ~500MB
arrayBuffer: ~500MB
我无法弄清楚哪个代码正在泄漏,有很多工具可以诊断node.js中的内存泄漏,但是几乎所有工具都是观看HEAP
而不是RSS
。
注意:我没有使用任何
var
关键字,我讨厌它。
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论