我正在开发 Node JS 应用程序并面临严重的内存压力问题。以下是启动应用程序后 60 分钟内的内存使用趋势(在恒定负载下):
内存使用率急剧上升到 95%,但之后保持相当稳定。
我之前和之后都进行了内存转储,但似乎我捕获转储的方式存在一些问题,因为两个转储文件之间的差异只有几 MB。
以下是 chrome 分析中 heapdump 的样子:
但我对此很陌生,不确定我应该寻找什么。
有人可以提供有关如何在这里找出内存问题、如何检测内存泄漏或如何理解此处提到的堆转储文件的任何指示吗?
节点版本:0.12.14
- find node_modules -type f -name "*.node"- 的输出如下:
node_modules/simpleflake/node_modules/bignum/build/Release/bignum.node
node_modules/simpleflake/node_modules/bignum/build/Release/obj.target/bignum.node
node_modules/heapdump/build/Release/addon.node
node_modules/heapdump/build/Release/obj.target/addon.node
node_modules/couchbase/build/Release/couchbase_impl.node
Run Code Online (Sandbox Code Playgroud)
- npm list --depth=0- 的输出如下:
aws-sdk@2.5.3
body-parser@1.11.0
check-types@6.0.0
couchbase@2.2.2
elasticsearch@10.1.3
expect@1.20.2
express@4.14.0
jshint@2.9.3
minimist@1.1.3
mocha@2.5.3
moment@2.9.0
morgan@1.5.3
newrelic@1.30.0
request@2.53.0
simpleflake@1.0.0
underscore@1.7.0
why-is-node-running@1.2.2 (https://github.com/mindtickle/why-is-node-running.git#96f3c8da54b110e8a9a1423361d2da7c125784f6)
winston@1.0.2
winston-aws-cloudwatch@0.4.2
Run Code Online (Sandbox Code Playgroud)
另外,是否可以查看我使用的任何包是否导致内存泄漏?
提前致谢。