fent / fent/node-ytdl-core

Stream.destroy() doesn't get garbage collected, creates memory leak.

Open
#1,180 6 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
JavaScript
Stars
4.7k
Forks
852
PR merge metrics
No merged PRs in 30d

Description

Using discord.js voice, latest version. ytdl is also latest.
after destroying the stream, when using chrome devtools, it shows a JsArrayBufferData object (or multiple, not sure) is left behind, even after garbage collecting manually (tested the garbage collector, it does work.)

```
player.audiostream = ytdl(ytlink, {//playerr.audiostream = ytdl(ytlink, {
filter: "audioonly", quality: 'highestaudio', format: 'webm', highWaterMark: 1 << 25, requestOptions: {
headers: {
cookie: COOKIE
}
}
})
let res = createAudioResource(player.audiostream);
player.play(res)
let killstream = function(){ //logs false then true, meaning the stream *should* be destroyed
console.log(this.audiostream.destroyed)
this.audiostream.destroy()
console.log(this.audiostream.destroyed)
}
player.once(AudioPlayerStatus.Idle, killstream)
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.