Skip to content
This repository has been archived by the owner on May 10, 2024. It is now read-only.

Fix #8292: Change the minimum number of engines available #8288

Merged
merged 2 commits into from
Oct 20, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,12 @@ import os.log
public actor AdBlockStats {
/// The max number of enabled filter lists depending on the amount memory available to the device
static var maxNumberOfAllowedFilterLists: Int = {
let memory = Int(ProcessInfo.processInfo.physicalMemory / 1073741824)
ContentBlockerManager.log.debug("Memory: \(memory)")
return min(5 * memory, 40)
// Get the number of gigs (memory in bytes divided by the size of a gig in bytes)
let numberOfGigs = Int(ProcessInfo.processInfo.physicalMemory / 1073741824)
ContentBlockerManager.log.debug("Number of gigs (rounded down): \(numberOfGigs)")
// Take a value between 20 and 40,
// with the real value somewhere in the middle depending on the device's memory
return max(min(5 * numberOfGigs, 40), 20)
}()

typealias CosmeticFilterModelTuple = (isAlwaysAggressive: Bool, model: CosmeticFilterModel)
Expand Down