How to check the size of a javascript object (in memory)

Asked

Viewed 615 times

4

How to check the size of a javascript object (in memory) using pure javascript?

1 answer

3


It does not seem possible, however there is a library able to estimate the size of an object.
After added just use the sizeof() function. For example:

var tamanho = sizeof(objeto);
  • 1

    Interesting, I didn’t know. I took a look at the code, and I saw that the library does a simple account, depending on the types of the data and the size of the objects' keys. With that she gives a estimating of the occupied space. The language does not support memory inspection, so the actual space occupied is impossible to obtain with it.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.