tonistiigi / mega

THIS REPO IS NOT MAINTAINED. Unofficial Node.js SDK for Mega
http://tonistiigi.github.com/mega
118 stars 33 forks source link

Memory quota exceeding on heroku #31

Open prashanthca opened 9 years ago

prashanthca commented 9 years ago

Trying to use this sdk on heroku, where the memory limit is 512 MB on free dynos. Getting this error in the logs. The first few lines are application metrics, which indicate the memory usage, and the last two lines are the errors.

2015-10-20T18:32:41.148711+00:00 heroku[web.1]: 
source=web.1 dyno=heroku.42704105.f21ba872-0746-4bf5-be7c-d35b344955ea
sample#memory_total=518.14MB sample#memory_rss=120.08MB
sample#memory_cache=391.92MB sample#memory_swap=6.14MB
sample#memory_pgpgin=334805pages sample#memory_pgpgout=206288pages

2015-10-20T18:32:41.148711+00:00 heroku[web.1]: Process running mem=518M(101.2%)
2015-10-20T18:32:41.148711+00:00 heroku[web.1]: Error R14 (Memory quota exceeded)

What I'm basically trying to do in my app is download a file from a remote server and upload it to MEGA. This error occurs after the uploading starts. I've used memwatch to check for memory leaks, but there aren't any. I'm not sure how to approach this problem since I'm new to node.js. Would appreciate any help on this. Thanks in advance.

edtechd commented 8 years ago

The script loads all content to upload into memory, so if you want to upload a lot of data, memory quota will be exceeded.

I think it makes sense to rewrite uploading procedure to avoid buffering of the data, but I am not sure that it is possible.

Please let me know if you found another solution.