hydralauncher / hydra

Hydra is a game launcher with its own embedded bittorrent client
MIT License
11.4k stars 2.82k forks source link

[BUG] High memory сonsumption on downloading #735

Open Borshig opened 4 months ago

Borshig commented 4 months ago

Describe the bug

High memory сonsumption on downloading a game. I got a 5GB+ memory сonsumption when try to download Noita (about 6.7Gb total)

Steps to Reproduce

  1. Choose a game to download
  2. Start donwload a game and open taskmanager) look at peak working memory, commited memory

Expected behavior

Low memory consumption. Similar to torrent clients

Screenshots

image

Operating System

Windows 10

Hydra Version

2.0.2.0

Additional Information

No response

Xxxsusx commented 4 months ago

Sorry, but sadly there isn't much to do about it. It's not actually Hydra it self but it also is Hydra consuming memory.

Let me explain, when you download a game, Hydra uses Torrent to eventually extract the games right? That's the reason it consumes a lot of memory. Torrent always does that and it's completely normal. The reason Torrent does that is to make Windows eventually focus more on the program so there isn't any lack of seeds to make the downloading eventually slower.

Torrent will put cache files into memory by default, this is to reduce access to hard disk to increase performance. You should add more RAM to your system, after all, there isn't much a software can do for hardware limitations.

In some Torrent clients, it is possible to disable cache in the settings to reduce RAM usage but that eventually would require using the hard disk almost everytime + the speed difference between RAM and hard disk is very large. Hydra doesn't have a option to disable Torrent cache yet, so there isn't pretty much to do about it.

fernando-ss-soares commented 3 weeks ago

I did a behavior analysis and in fact the high consumption occurs when the app carries out the process of validating the file during the download process. I didn't validate the source code, but I imagine it could be a performance problem related to the Buffer, which is stored in RAM and after validation is discarded from memory.