Currently i am doing a simple db migration through Javascript. I find myself wanting to keep track of some simple id -> object maps to make less SQL db calls.
So the question is, what is the maximum size of a javascript object in node? Say i have a very simple table with 2000 records. I am only interested in two columns, is it possible for me to just store all these values under a plain JS object that looks like {id1: {col1: "foo", col2: "bar"}, id2: {col1: "ss", col2: "bb"}} ??
If 2000 is okay, what is the maximum that i can do?
Currently i am doing a simple db migration through Javascript. I find myself wanting to keep track of some simple id -> object maps to make less SQL db calls.
So the question is, what is the maximum size of a javascript object in node? Say i have a very simple table with 2000 records. I am only interested in two columns, is it possible for me to just store all these values under a plain JS object that looks like {id1: {col1: "foo", col2: "bar"}, id2: {col1: "ss", col2: "bb"}} ??
If 2000 is okay, what is the maximum that i can do?
Share Improve this question edited May 20, 2016 at 4:48 Jonathan Lonowski 124k35 gold badges202 silver badges202 bronze badges asked May 20, 2016 at 4:31 Zhen LiuZhen Liu 7,93215 gold badges56 silver badges104 bronze badges 4- 1 It obviously depends on browser implementation – vp_arth Commented May 20, 2016 at 4:41
- Why don't you just test it? – user663031 Commented May 20, 2016 at 6:01
- @vp_arth I was talking about node. – Zhen Liu Commented May 20, 2016 at 15:23
-
read
browser
asengine
– vp_arth Commented May 20, 2016 at 15:27
2 Answers
Reset to default 4It's NO PROBLEM
In my app, I just store some logs in an Array instance and set a length limit of 10000;
var maxListLength = 100000;
This make the Array instance size reach to 50MB more or less;
And when the app is running, there may be 100 of this kind of instance, but with no problem;
What should you do is to increase memory limit for Node process in V8:
node --max-old-space-size=4096 your_app.js
According to this issue on V8. Chrome can support no more than 2GB of object in memory.
https://bugs.chromium/p/v8/issues/detail?id=847