Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory usage goes up downloading a torrent but never goes down again after it finishes #2245

Closed
Noxde opened this issue Jan 16, 2022 · 1 comment
Labels

Comments

@Noxde
Copy link

Noxde commented Jan 16, 2022

What version of this package are you using?
1.5.7

What operating system, Node.js, and npm version?
linux x64, 16.13.2, 8.1.2 (heroku)
windows11 x64, 16.13.2, 8.1.2 (my pc)

What happened?
im using webtorrent to make a bot to download torrents and its hosted on heroku, having the free plan i have available 512Mb of memory, i can see that when it finished downloading a small torrent it might reach around 100Mb of memory having started at around 60Mb of memory usage when idle(i checked this using process.memoryUsage().rss) and it won't go down so when i start downlodaing another torrent it starts at 100Mb of memory usage eventually crashing.
another issue i had is memory usage while downloading it goes up pretty fast in bigger torrents with more seeders but i'd like to first fix the former issue

this is the code im using.

const WebTorrent = require("webtorrent");
const client = new WebTorrent();

client.add(args[1], { path: "./temp/" }, (torrent) => {
  let update = setInterval(() => {
    console.table(
      client.torrents.map((t) => ({
        torrent: t.name,
        progress: `${(t.progress * 100).toFixed(2)}%`,
        speed: `${(t.downloadSpeed / 1000000).toFixed(2)}Mb/s`, 
      }))
    );
  }, 2000)

  torrent.on('done', () => {
    t.destroy({ destroyStore: true });
  }
});

What did you expect to happen?
i expected the memory usage to go down the same amount it went up or approximately

Are you willing to submit a pull request to fix this bug?
i don't know how this could be fixed as the only experience i have is making some discord bots but i would like to help to fix this if i knew how to.

this is the first issue i ever made, im not sure if this is a webtorrent issue but i tried downloading a few different torrents on my pc using this and hosting it on heroku and i got the same results, i tried using a readStream and writeStream instead of this approach but the issue was still there sorry if there is anything wrong with this post

@github-actions
Copy link

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

@github-actions github-actions bot added the stale label Mar 18, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 29, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant