Hello,
We are building a URL filter with NEURLFilterControlProvider and PIR on iOS 27.2. Our blocklist needs to scale to 50 million URLs at a 0.1% false-positive rate. Following the documented Bloom filter format, that is a prefilter of 718,879,379 bits with 10 hash functions (89,859,923 bytes), which we return from fetchPrefilter(existingPrefilterTag:) as NEURLFilterPrefilter.PrefilterData.temporaryFilepath.
On an iPhone 17 running iOS 27.2, we see two behaviours that make a prefilter of this size unreliable for users who also run a VPN.
- neagent keeps each prefilter it receives in its own memory and does not release the previous one
After the first handover, neagent's memory footprint was 89.6 MiB, almost all of it anonymous memory, even though lookups are served from the mmap'd file under /private/var/db/urlPrefilter/. Each time we returned a new prefilter (with a new tag), the footprint grew by the size of the new bitmap, in the same neagent process: 89.6 MiB, then 150.8 MiB after a 64 MB prefilter, then 236.9 MiB after another 90 MB prefilter. It stayed at that level for the more than 25 minutes we observed. With no other network extension installed, neagent was not terminated at 236.9 MiB.
- When a packet tunnel VPN shares the same neagent, neagent is terminated at about 90 MiB
With a packet tunnel VPN enabled (Tailscale), which iOS hosts in the same neagent process as our URL filter, neagent was terminated with JETSAM_REASON_MEMORY_HIGHWATER while holding a single prefilter at 89.4–89.7 MiB. This happened 11 and 35 minutes after start in our latest runs, with no PIR lookups and no new prefilter, and repeatedly in earlier runs (between 3 seconds and 52 minutes after start). Each termination stops both sessions: the URL filter with "Plugin failed" and the VPN with "Plugin initiated". Both restart a few seconds later, and the cycle repeats. Because a new prefilter adds a full copy (finding 1), any prefilter update also takes neagent over this limit straight away.
Our questions:
- What is the largest NEURLFilterPrefilter that iOS supports, and does the limit depend on the device?
- Is neagent meant to keep the whole bitmap in its own memory, rather than read it from the mmap'd file?
- Should the previous prefilter's memory be released when a new one is installed? If not, how often should a control provider return a new prefilter?
- Is neagent's memory limit lower when a VPN shares the process, and is that intended? Can a URL filter run in its own neagent process?
- What approach do you recommend for a blocklist of tens of millions of URLs at a 0.1% false-positive rate?
Thank you,
David.
Apple Developer Team ID: SSYCLSN43U