
Loading…
[Safari/General] Schedule manually updating filter lists less aggressively to give time for garbage collection #978
Owner
chrisaljoudi
commented
gorhill
commented
When you say "give time for garbage collection", how many seconds to do you in mind?
Owner
chrisaljoudi
commented
@gorhill 3-5 seconds seems to be plenty. Minimum one could get away with is around 1s.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Right now, when uBlock is updating filter lists, it grabs and parses them as quickly as it can receive and parse them.
In some cases, when there's a large quantity of those updates, the memory allocation for all the "new" resources occurs before the browser has had a chance to actually garbage collect and deallocate memory.
This is what happens in #964. In the case of Safari, this causes it to run out of memory and crash as it fails trying to allocate more memory. In that case, it took only a couple of large filter lists (EasyList and the Russian list) to reproduce the crash.
This is problematic, especially with cases with a lot of lists/system with little memory. The crash is arguably a Safari bug — it seems like it would be beneficial in general to have filter list updates be less aggressive and more atomic as not to pressure memory.
Perhaps there should be an update task running in the background to perform the updates. It might wait, say, 10 seconds between any two consecutive updates.
In that case, clicking "Update Now" doesn't necessarily go and trigger every request all at once, but rather marks enabled filters as needing an update. The update task, like a janitor, will come along and sweep the needed updates asynchronously.
#965 would make a lot of sense implement alongside this.
@gorhill as always, I'm happy to own this particular fix/issue if you don't have time to work on it. Please let me know.