Skip to content

DomainMatcher: Reduce runtime memory usage and startup peak memory on iOS - #5924

Merged
RPRX merged 1 commit into
mainfrom
iOS-memory
Apr 13, 2026
Merged

RPRX merged 1 commit into
mainfrom
iOS-memory

Conversation

@Meo597

@Meo597 Meo597 commented Apr 13, 2026

Copy link
Copy Markdown
Collaborator

Closes #4422

@Meo597

Meo597 commented Apr 13, 2026

Copy link
Copy Markdown
Collaborator Author

绝大多数配置中 dns 和 router 的 domain rule 会有很多交集
现在它们能共用一份内存以降低运行时占用
image

其实仍有进一步优化空间让 geosite:category-ads-all 能用起来,这玩意会吃掉 40mb
以后再说,现在应该够用了

@RPRX
RPRX merged commit 05a1191 into main Apr 13, 2026
78 checks passed
@Meo597
Meo597 deleted the iOS-memory branch April 13, 2026 19:17
@t-e-s-tweb

Copy link
Copy Markdown

@Meo597 request to add this android too here "case "ios":". I tested it with android added and it reduces the startup time from 3-5 secs to nearly instantaneous and routing works fine.

@Meo597

Meo597 commented Apr 14, 2026

Copy link
Copy Markdown
Collaborator Author

@t-e-s-tweb 你测过我就放心多了!

android 内存也紧张吗?
这里的 case "ios" 影响的只是启动时的峰值内存,代价是匹配性能低数百纳秒。

@t-e-s-tweb

Copy link
Copy Markdown

@t-e-s-twebI feel much more at ease now that you've tested it!

Is Android also experiencing memory constraints? The "ios" case here only affects peak memory usage at startup, at the cost of a few hundred nanoseconds of slower matching performance.

No, memory isn't the problem. But the app takes ages to start up when you're using "category-ads-all," even with just a 3MB geosite and the Hagezi list. Since the app gets started and stopped a bunch of times, way more often than a router would, all those extra seconds really stack up.

@Meo597

Meo597 commented Apr 14, 2026

Copy link
Copy Markdown
Collaborator Author

明白你的意思了
android 用的是默认 mphmatcher
它在移动端可能需要编译几秒

如果从缩短启动时间的角度,那么 android 也可以加

@Meo597

Meo597 commented Apr 18, 2026

Copy link
Copy Markdown
Collaborator Author

iOS 内存还可以进一步往下压
cn !cn ads-all 加一起用不到 10mb

但鉴于一次重构弄出三个 issue 尿不尽一样
还是以后再说吧

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

iOS packet tunnel provider limit

3 participants