nodejs 内存分析 [英] nodejs memory profiling

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

问题描述

需要分析节点进程.在运行节点进程几天后,我在生产中出现了一些内存泄漏.

Need to profile node process. i've some memory leaks in production, after some days of running node process.

我尝试过 node-inspector + v8,但它不起作用,在新版本的 node-inspector 中没有配置文件选项卡.在旧版本中,当我开始分析错误并停止调试.

i've tried node-inspector + v8, but it doesn't work, in new version of node-inspector there is no Profile tab. and in old version when i start profiling error is fired and debugging stopped.

我也试过 nodetime.com,但它没有显示我需要的东西,而且它占用太多内存,不适用于生产.

i've also tried nodetime.com, but it doesn't show what i need, also it takes too much memory, it's not for production.

我也试过 dtrace(http://blog.nodejs.org/2012/04/25/profiling-node-js/) 但它没有给我必要的信息.

i've also tried dtrace (http://blog.nodejs.org/2012/04/25/profiling-node-js/) but it doesn't give me necessary information.

那么我需要什么信息来分析内存:
获取实时实例、实例数量、内存大小、实例类型

so what information i need for profiling memory:
get live instances, instances count, size in memory, instance types

你知道如何获取这些信息吗?

do u know how to get that information?

推荐答案

我找到了 node-memwatch 有用.

缺点是您必须将它嵌入到您的应用程序中并为其编写一些代码,但它对于检查不同位置的堆以查看在您执行某些操作后更改了多少很有用.

The downside is you have to embed it in your application and have a bit of code for it, but it's useful for checking the heap at various places to see how much it changed after you did something.

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

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