fortheusers / hb-appstore

Homebrew App Store - GUI for downloading/managing homebrew apps
https://hb-app.store
GNU General Public License v3.0
1.05k stars 61 forks source link

[switch] Can crash while downloading some apps #29

Closed vgmoose closed 4 years ago

vgmoose commented 5 years ago

Some users are reporting crashing while downloading "large-ish" packages, like Retroarch (20MB). I haven't been able to reproduce it at that scale, but I do crash trying to download DDLC (200MB).

Both issues might stem from the fact that while downloading, everything is written to RAM and only writes to disk after the download is done, causing out of memory errors if there isn't enough free memory available (which may change from setup to setup, such as which cfw, system version, or the way the app store is launched (NSP or otherwise)).

It would be nice to workaround this in a way that doesn't make us have to wait for SD card I/O (which tends to be slow-ish). Potentially detecting free memory available in the curl write callback, and if it's running low, write everything so far to disk and free memory before continuing.

vgmoose commented 4 years ago

https://github.com/vgmoose/libget/pull/26 will fix this!

The problem has become more annoying in 2.1, as we've continued adding apps to the store and it didn't have asynchronous loading yet, resulting in much less memory being available during download