You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Running below code, with evey request, the app memory usage ( RSS ) increases until server runs out of memory.
Why the buffers are not garbage collected after response is sent ?
importhttpfrom'http'importbusboyfrom'busboy'http.createServer((req,res)=>{if(req.method==='POST'){constbb=busboy({headers: req.headers});bb.on('file',(name,file,info)=>{constchunks=[];file.on('data',(data)=>{chunks.push(data);})file.on('end',()=>{console.log(info,Buffer.concat(chunks));})})bb.on('close',()=>{res.writeHead(200,{Connection: 'close'});res.end("Data Received")});req.pipe(bb);}}).listen(3000,()=>{console.log("Listening for requests")})
The text was updated successfully, but these errors were encountered:
If you set the --expose-gc CLI flag you can explicitly trigger the V8 GC with global.gc(), but that should only be for troubleshooting and not for production use. For controlling memory you're better off using the other V8 flags that dictate various maximum memory usages.
Manually calling the garbage collector had no effect. I suspect that something holds a strong reference to buffers, preventing them from being garbage collected.
Running below code, with evey request, the app memory usage ( RSS ) increases until server runs out of memory.
Why the buffers are not garbage collected after response is sent ?
The text was updated successfully, but these errors were encountered: