Vanwaril
Vanwaril

Reputation: 7528

Can you find the memory allocated to an object (node.js)?

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?

Upvotes: 4

Views: 5979

Answers (1)

Tobias P.
Tobias P.

Reputation: 4665

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

Upvotes: 5

Related Questions