2

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?

4
  • 1
    It obviously depends on browser implementation Commented May 20, 2016 at 4:41
  • Why don't you just test it? Commented May 20, 2016 at 6:01
  • @vp_arth I was talking about node. Commented May 20, 2016 at 15:23
  • read browser as engine Commented May 20, 2016 at 15:27

2 Answers 2

4

It'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
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks you've answered my question - although i can't change the --max-old-space-size stuff, i think i know what the limit is now.
2

According to this issue on V8. Chrome can support no more than 2GB of object in memory.

https://bugs.chromium.org/p/v8/issues/detail?id=847

1 Comment

it does slow down and eventually freeze once the total memory usage reaches around 2GB. At least it was when i was doing pressure test on a large scale data visualization project in August 2017.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.