Meteor Out of Memory

妖精的绣舞 提交于 2019-12-21 04:28:06

问题


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 ?


回答1:


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.




回答2:


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




回答3:


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




回答4:


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.




回答5:


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).




回答6:


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.



来源:https://stackoverflow.com/questions/32421928/meteor-out-of-memory

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!