Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

how much memory does node allocate for null values in arrays

how much memory does node allocate for null values in arrays

Problem

Following up on this thread:

Lots of Null Values in an array mean any harm?

I did this with node.js:

arr=[]
arr[1000]=1
arr[1000000000]=2
arr.sort()

And I got

FATAL ERROR: JS Allocation failed - process out of memory

So that leaves me with the question (I couldn't find it on Yahoogle) how much Memory is actually allocated for a null entry in an array in node. I do not plan to use 1000000000 entries, not even close, but maybe it's still not worth allocating the memory...

Who knows how I can check?

Problem courtesy of: EasierSaidThanDone

Solution

So in summary, node.js does not allocate memory for undefined values in an array. The crash I experienced must have been a glitch as no one else could reproduce it and installing the latest node.js version eliminated the problem for me as well.

Solution courtesy of: EasierSaidThanDone

Discussion

View additional discussion.



This post first appeared on Node.js Recipes, please read the originial post: here

Share the post

how much memory does node allocate for null values in arrays

×

Subscribe to Node.js Recipes

Get updates delivered right to your inbox!

Thank you for your subscription

×