Bugswriter / notflix

Notflix is a shell script to search and stream torrent.
GNU General Public License v3.0
1.9k stars 176 forks source link

notflix eating ram #19

Open Etaash-mathamsetty opened 2 years ago

Etaash-mathamsetty commented 2 years ago

image

this was after running notflix, hogged 3-5 gb of ram after running and closing it. I am still clueless on how to free the ram.

PRESFIL commented 2 years ago

notflix creates temporary directory in /tmp for WebTorrent. It can be deleted, but it would be nice to make a cli switch that enables auto-deletion upon notflix exits. Not all users have terabytes of RAM.

Etaash-mathamsetty commented 2 years ago

notflix creates temporary directory in /tmp for WebTorrent. It can be deleted, but it would be nice to make a cli switch that enables auto-deletion upon notflix exits. Not all users have terabytes of RAM.

thanks, I can write some cleanup code at the end of the shellscript now

Etaash-mathamsetty commented 2 years ago

ok so adding rm -dRf /tmp/webtorrent at the end of the file is the fix :D

phodina commented 2 years ago

Well, better way would be to use trap to call this function on exit and place this call at the top of the script. I can write the MR

trap "rm -dRf /tmp/webtorrent" EXIT
Etaash-mathamsetty commented 2 years ago

Well, better way would be to use trap to call this function on exit and place this call at the top of the script. I can write the MR

trap "rm -dRf /tmp/webtorrent" EXIT

yeah that's better, since if i ctrl-c then the files won't be delted

PRESFIL commented 2 years ago

Do you want under-downloaded files to hang in memory? Something more reliable can be used:

trap "rm -dRf /temp/webtorrent" SIGINT SIGTERM ERR EXIT

(from nyaa)

In any case, it may be worth reconsidering the decision to store temporary files in /tmp/. nyaa downloads everything to the $HOME/Downloads/ directory.

Monjurul-Hasan-Sohan commented 2 years ago

Is it

/temp/webtorrent or /tmp/webtorrent

Etaash-mathamsetty commented 2 years ago

Is it

/temp/webtorrent or /tmp/webtorrent

99% sure it is /tmp