内存错误节点JS(node :: smalloc :: Alloc)

我是节点Js的新手,我构build了一个非常简单的服务器,可以将我请求的zip文件发回给我。 这一切都工作,但在一些请求发生崩溃后,我在terminal上可视化此消息:

致命错误:node :: smalloc :: Alloc(v8 :: Handle,size_t,v8 :: ExternalArrayType)内存不足

var http = require('http'); var url = require('url'); var fs = require('fs'); var port = 1337; // create http server var server = http.createServer(function (request, response) { var path = require('url').parse(request.url, true); console.log('requested ' + path.pathname); //get zipped resoures if (path.pathname == '/getzip') { console.log(request.url); var queryData = url.parse(request.url, true).query; if (queryData.name) { var filename = queryData.name; //open corrisponding file var zipFile = fs.readFileSync('packets/' + filename); response.writeHead(200, { 'Content-Type': 'application/x-zip', 'Content-disposition': 'attachment; filename=data.zip' }); //send file in response response.end(zipFile); } else { response.writeHead(200, {'Content-Type': 'text/plain'}); response.end('{error = "bad url"}'); } } }).listen(port); server.timeout = 1000000; 

你有什么想法是什么? 这段代码看起来很简单。

       

网上收集的解决方案 "内存错误节点JS(node :: smalloc :: Alloc)"