majestrate / XD

meme bittorrent client
https://xd-torrent.github.io/
MIT License
233 stars 25 forks source link

Significant spike in RAM usage for a few brief moment when adding torrent files. #116

Closed barkoder closed 1 month ago

barkoder commented 2 months ago

version: 0.4.6

OS: Windows 7 x64 SP1 with VxKex

Error messages: no

Backtrace: no

Steps to reproduce:

Install xd 0.4.6.

  1. Create a torrent with a single 5GB file.

  2. Open a free memory monitor, like Task Manager, or something else.

  3. Move torrent file to the downloads directory.

  4. Notice the sudden ~5GB spike in RAM usage.

I noticed that the size of the spike in memory is about the same as the size of the file in the torrent. The memory usage of xd stays pretty much the same, but xd appears to be doing some sort of caching before pre-allocating the space on disk.

I would appreciate a way to turn off caching in RAM and pre-allocation.

Thanks!

Also this issue is not related to #44 .

majestrate commented 2 months ago

https://github.com/majestrate/XD/blob/master/lib/util/ensurefile.go#L21

this is what we do instead of fallocate as windows lacks an ability to do sparse allocation. i'd have to totally redo storage in XD to accommodate this feature request.

barkoder commented 2 months ago

I see. If this is the case, please consider listing this issue as a "Windows limitation", in bold , both here https://xd-torrent.github.io/ and https://github.com/majestrate/XD .

That sudden spike in RAM usage got me dangerously close to running out of memory.

It would help Windows users with low RAM avoid catastrophe, in case they try to torrent a 25 GB file with 8GB of RAM.

Thanks!