Skip to content
This repository has been archived by the owner on Sep 9, 2022. It is now read-only.

[Safari/General] Schedule manually updating filter lists less aggressively to give time for garbage collection #978

Closed
chrisaljoudi opened this issue Mar 10, 2015 · 3 comments

Comments

@chrisaljoudi
Copy link
Contributor

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.

@chrisaljoudi chrisaljoudi changed the title [Safari/General] Make updating filter lists less aggressive to give time for garbage collection [Safari/General] Schedule updating filter lists less aggressively to give time for garbage collection Mar 10, 2015
@gorhill gorhill added the Fixing label Mar 10, 2015
@gorhill
Copy link
Contributor

gorhill commented Mar 10, 2015

When you say "give time for garbage collection", how many seconds to do you in mind?

@chrisaljoudi
Copy link
Contributor Author

@gorhill 3-5 seconds seems to be plenty. Minimum one could get away with is around 1s.

gorhill added a commit that referenced this issue Mar 11, 2015
gorhill added a commit that referenced this issue Mar 11, 2015
@gorhill
Copy link
Contributor

gorhill commented Mar 11, 2015

Fixed in 39ad158.

@gorhill gorhill closed this as completed Mar 11, 2015
@gorhill gorhill removed the Fixing label Mar 11, 2015
@gorhill gorhill changed the title [Safari/General] Schedule updating filter lists less aggressively to give time for garbage collection [Safari/General] Schedule manually updating filter lists less aggressively to give time for garbage collection Mar 12, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants