Closed ocylib closed 2 years ago
the stream.pipe(res)
should also pipe events like close from res to stream
ytdl should then do some cleanup and the node garbage collection should free the memory at some point
what u're experiencing is a browser limit - allowing only 6 open sockets to a given server
Nice work. I opened six tabs in one browser and six tabs in another browser, same PC, everything is fine
I created a server as follow:
by doing this, when I run the server, I can watch the video at
localhost:3000
. it seems everything is finehowever, when I open more than six tabs to open the same page(
localhost:3000
), the sixth tab will never respond to anything and the network is pending until closing a tab.I thought the lake of memory caused this. and I add the following codes:
when the server starts before opening many tabs, the memory used about 34M went tabs opened, until never respond, the memory used about 60M close all tabs, the memory used about 55M, will never return to 34M
I wonder what miniget does when the browser tab is closed, will it stop the request automatically and clear memory or not? if not, I tried
res.on('close',()=>{stream._destroy()})
, but it seems doesn't work