Z. Clément
Z. Clément

Reputation: 474

Meteor Out of Memory

I'm using meteor to make scrapping engine and I have to do a HTTP GET request and this send me an xml but this xml is bigger than 400 ko.

I get a exception "out of memory".

result =Meteor.http.get 'http://SomeUrl.com'

FATAL ERROR: JS Allocation failed - process out of memory

There is a way to increase memory limit of a variable ?

Upvotes: 7

Views: 5650

Answers (6)

tarrow
tarrow

Reputation: 31

It is possible to increase the memory available to your node application that is spawned using meteor.

I did not have success using the --max-old-space-size flag in the instance of node called in the meteor script nor in trying to change that in the script in meteor-tool as suggested by gatolgaj

However setting the environment variable NODE_OPTIONS="--max-old-space-size=8192" did work for me.

I saw it mentioned in this thread: https://groups.google.com/forum/#!topic/meteor-talk/C5oVNqm16MY

Upvotes: 3

alonso_50
alonso_50

Reputation: 1542

I know this question is solved and a bit old, but I would like to share my experience. After some research, I just updated my Meteor version. It seems they are recently taking more care about Out Of Memory Errors. So I will encourage you to update to new Meteor versions.

Upvotes: 1

Cees Timmerman
Cees Timmerman

Reputation: 19644

Same here on Windows 10 using Meteor 1.1.0.3:

C:\Users\Cees.Timmerman\AppData\Local\.meteor\packages\meteor-tool\1.1.4\mt-os.windows.x86_32\tools\fiber-helpers.js:162
    }).run();
       ^
FATAL ERROR: Evacuation Allocation failed - process out of memory

Resolved by setting console log level to "warning" instead of "debug" in settings.json used internally by a logger package like Winston 2.1.0 (var level = Meteor.settings.log_level).

Upvotes: 1

Lucidity
Lucidity

Reputation: 1369

I'm developing on Windows and had the same error. In my case, was caused by a flood of console.log statements. I disabled the log statements, and works fine again.

Upvotes: 3

gatolgaj
gatolgaj

Reputation: 1203

if you are Developing on windows

find meteor.bat in /APPData/Local/.meteor/packages/meteor-tool/<build-tool-version>/

edit the last line of the batch file which calls the node.exe and change to

"%~dp0\dev_bundle\bin\node.exe" --max-old-space-size=2048 "%~dp0\tools\main.js" %*

Hope this helps

Upvotes: 3

aknuds1
aknuds1

Reputation: 67987

You need to increase the amount of memory on your server, e.g. by enabling swap memory. To see how, assuming you're on Linux, you can f.ex. read DigitalOcean's guide on enabling swap memory on Ubuntu 14.04.

I don't know of any way to handle the case where Node runs out of memory, except perhaps you could separate the GET request into a child process so that the whole server doesn't crash in case you run out of memory.

To increase Node's memory limit, you could use Node's --max_old_space_size option.

Upvotes: 2

Related Questions