Out of memory issue

Hi
I have created a collection which has only one document with 4 attributes looks as below -


{
			"A" : "0" ,
			"B" : "0" ,
			"C" : "0" ,
			"D" : "0" ,
		}

This document is updated in every 500 ms .

After running sometime may be 10 to 15 mins it throws error as below-


e[34mW20161117-21:27:56.202(-8)? (STDERR) e[39me[35mC:\Users\FFC\AppData\Local\.meteor\packages\npm-mongo\2.2.11_2\npm\node_modules\mongodb\lib\utils.js:99e[39m
e[34mW20161117-21:27:56.203(-8)? (STDERR) e[39me[35m    process.nextTick(function() { throw err; });e[39m
e[34mW20161117-21:27:56.204(-8)? (STDERR) e[39me[35m                                  ^e[39m
e[34mW20161117-21:27:56.205(-8)? (STDERR) e[39me[35me[39m
e[34mW20161117-21:27:56.206(-8)? (STDERR) e[39me[35mRangeError: Out of memorye[39m
e[34mW20161117-21:27:56.206(-8)? (STDERR) e[39me[35m    at RangeError (native)e[39m
e[34mW20161117-21:27:56.207(-8)? (STDERR) e[39me[35m    at packages\meteor.js:1190:31e[39m
e[34mW20161117-21:27:56.207(-8)? (STDERR) e[39me[35m    at handleCallback (C:\Users\FFC\AppData\Local\.meteor\packages\npm-mongo\2.2.11_2\npm\node_modules\mongodb\lib\utils.js:96:56)e[39m
e[34mW20161117-21:27:56.207(-8)? (STDERR) e[39me[35m    at C:\Users\FFC\AppData\Local\.meteor\packages\npm-mongo\2.2.11_2\npm\node_modules\mongodb\lib\collection.js:1048:5e[39m
e[34mW20161117-21:27:56.208(-8)? (STDERR) e[39me[35m    at C:\Users\FFC\AppData\Local\.meteor\packages\npm-mongo\2.2.11_2\npm\node_modules\mongodb-core\lib\connection\pool.js:455:18e[39m
e[34mW20161117-21:27:56.208(-8)? (STDERR) e[39me[35m    at nextTickCallbackWith0Args (node.js:420:9)e[39m
e[34mW20161117-21:27:56.208(-8)? (STDERR) e[39me[35m    at process._tickCallback (node.js:349:13)e[39m

Can someone please suggest some solution .
I already tried to increase memory size as --max_old_space_size = 1024 .

I think you’ve accidentally created recursive code with no end strategy. Can we see your code?

I done that intentionally , i want my function to keep updating this collection for at least 24 hrs.

You can update documents like that without recursion.

But i only want to update document for 24 hrs in every 500ms , can you suggest me better solution , currently i am updating this using Meteor.setInterval() …

Can we see your code?

Sorry i can not share code but it looks like –

from client side –
Meteor.setInterval(function(){
Meteor.call(‘writeInCollection’,index);
}, 500);

In Server side —
writeInCollection: function(index){

var $set = {};
$set[“key_”+Index] = value;
Collection.update({_id : collection_id},{$set : $set} , function(err,data){

});

}

Hey i found one solution here –

but dont know how to set this argument. can you please suggest me in which file i should set this and how ?

I am using windows system

That’s not going to fix your problem, it’s just going to postpone the crashing. You have a memory leak somewhere, without more code it’s hard to tell. First thing is I wouldn’t update your document every 500ms, but cache your values on the server and only update like every 15 seconds.

In other words store your index/value objects in an array and every x amount of time update the document with the whole array instead of updating for every value.