最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Can you find the memory allocated to an object (node.js)? - Stack Overflow

programmeradmin1浏览0评论

I'm facing a memory leak, and while looking for the problem, wondered if there was some way in Node.js to find the memory allocated to a JavaScript Object. Node provides a way to find the overall heap and stack space, but I couldn't find anything in the documentation or online to find the space for a specific object.

Given the way variables work, it shouldn't be hard to write something within node to find the size, but I was wondering if something, maybe a JavaScript function, already exists to do it?

I'm facing a memory leak, and while looking for the problem, wondered if there was some way in Node.js to find the memory allocated to a JavaScript Object. Node provides a way to find the overall heap and stack space, but I couldn't find anything in the documentation or online to find the space for a specific object.

Given the way variables work, it shouldn't be hard to write something within node to find the size, but I was wondering if something, maybe a JavaScript function, already exists to do it?

Share Improve this question edited Feb 12, 2011 at 2:36 Vanwaril asked Feb 11, 2011 at 17:29 VanwarilVanwaril 7,5787 gold badges35 silver badges47 bronze badges 2
  • 1 There's some kind of memory management plugin for node.js. Maybe in the v8 toolchain – Raynos Commented Feb 11, 2011 at 17:35
  • Chips. I think I pressed the wrong button. This did not deserve down-vote, but upvote! – Alfred Commented Dec 31, 2012 at 1:42
Add a ment  | 

1 Answer 1

Reset to default 5

There's Node-Profiler you could use to take 2 heap snapshot and search for large objects by paring their values.

发布评论

评论列表(0)

  1. 暂无评论