内存泄漏节点js [英] Memory leak node js

查看:98
本文介绍了内存泄漏节点js的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的nodejs应用程序发生内存泄漏.为了恢复应用程序的用途,它是一个由iOS应用程序调用的api,并且是一个后台管理某些内容的后台. 该应用程序正在生产中,由于利用率问题,我们会遇到一些内存泄漏.

I have a memory leak on my nodejs application. In order to resume the purpose of the application, it's an api called by an iOS application and a backoffice to administrate some content. The application is in production and we experience some memory leak due to utilisation.

服务器上的内存始终在增加,而从未减少. 我尝试使用node-heapdump分析问题.

The memory on the server is always going up and never going down. I try to analyze the problem using node-heapdump.

首先,我看到node-heapdump提供的快照的堆大小与应用程序在内存中占用的大小(堆大小〜30Mb和RAM大小〜100Mb)之间存在很大差异来自?

First of all, i see a big difference between the heap size of the snapshot given by node-heapdump and the size taken by the app in the memory (heap size ~ 30Mb and RAM size ~ 100Mb), where that difference came from ?

然后我只是通过刷新不返回任何内容的主页看到堆大小的增加. 有谁知道我的问题可能在哪里?

Then i see an increment of the heap size just by refreshing a home page who does not return anything. Is anyone has an idea of where my problem could be ?

有关信息,我使用nodejs版本0.10.x和expressjs 4.0.0

For information i use nodejs version 0.10.x and expressjs 4.0.0

预先感谢大家.

编辑

我安装了memwatch-next,并引发了泄漏事件. 我的错误是这个:

I install memwatch-next and the leak event is raised. The error i have is this one :

警告:检测到可能的EventEmitter内存泄漏. 11个泄漏侦听器 添加.使用Emitter.setMaxListeners()增加限制.

warning: possible EventEmitter memory leak detected. 11 leak listeners added. Use emitter.setMaxListeners() to increase limit.

我尝试设置defaultMaxListeners,但是当我向应用程序施加压力时,会在一段时间后引发泄漏事件. 有人知道该错误意味着什么吗?

I try to set the defaultMaxListeners but when i stress the application the leak event is raised after sometime. Does anyone knows what that error means ?

推荐答案

看看memwatch-next

我在使用memwatch软件包时遇到了类似的问题,并切换到了memwatch-next,它安装时没有出现node-gyp错误,并且可以正常工作.至于RSS和heapdump之间的区别,我和您是同一个人.

have a look at memwatch-next

I had similar issues with the memwatch package and switched to memwatch-next and it installed without the node-gyp error and produced worked. As for the difference between the RSS and the heapdump , I am in the same boat as you are.

这篇关于内存泄漏节点js的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆