Skip to content

Conversation

@hossinasaadi
Copy link
Contributor

Reduce Protobuf Memory Usage on iOS

Under the same routing configuration on iOS, memory usage drops from 28.6 MB (main) to 25.1 MB with this PR, saving ~3.5 MB of RAM.
@Fangliding Could you please check the VmHWM value?

@RPRX

@hossinasaadi
Copy link
Contributor Author

also some test result on macos :

PR:
ReadOnly portion of Libraries: Total=890.9M resident=142.4M(16%) swapped_out_or_unallocated=748.4M(84%)
Writable regions: Total=71.3M written=3953K(5%) resident=10.9M(15%) swapped_out=0K(0%) unallocated=60.4M(85%)
==== Writable regions for process 34931
ReadOnly portion of Libraries: Total=890.9M resident=142.4M(16%) swapped_out_or_unallocated=748.4M(84%)
Writable regions: Total=71.3M written=3953K(5%) resident=10.9M(15%) swapped_out=0K(0%) unallocated=60.4M(85%)
==== Writable regions for process 34931
ReadOnly portion of Libraries: Total=890.9M resident=142.4M(16%) swapped_out_or_unallocated=748.4M(84%)
Writable regions: Total=71.3M written=3953K(5%) resident=10.9M(15%) swapped_out=0K(0%) unallocated=60.4M(85%)
==== Writable regions for process 34931
ReadOnly portion of Libraries: Total=890.9M resident=142.4M(16%) swapped_out_or_unallocated=748.4M(84%)
Writable regions: Total=71.3M written=3953K(5%) resident=10.9M(15%) swapped_out=0K(0%) unallocated=60.4M(85%)
==== Writable regions for process 34931
ReadOnly portion of Libraries: Total=890.9M resident=142.4M(16%) swapped_out_or_unallocated=748.4M(84%)
Writable regions: Total=71.3M written=3953K(5%) resident=10.9M(15%) swapped_out=0K(0%) unallocated=60.4M(85%)
==== Writable regions for process 34931
ReadOnly portion of Libraries: Total=890.9M resident=142.4M(16%) swapped_out_or_unallocated=748.4M(84%)
Writable regions: Total=71.3M written=3953K(5%) resident=10.9M(15%) swapped_out=0K(0%) unallocated=60.4M(85%)
==== Writable regions for process 34931
ReadOnly portion of Libraries: Total=890.9M resident=142.4M(16%) swapped_out_or_unallocated=748.4M(84%)
Writable regions: Total=71.3M written=3953K(5%) resident=10.9M(15%) swapped_out=0K(0%) unallocated=60.4M(85%)
==== Writable regions for process 34931
ReadOnly portion of Libraries: Total=890.9M resident=142.4M(16%) swapped_out_or_unallocated=748.4M(84%)
Writable regions: Total=71.3M written=3953K(5%) resident=10.9M(15%) swapped_out=0K(0%) unallocated=60.4M(85%)
==== Writable regions for process 34931
ReadOnly portion of Libraries: Total=890.9M resident=142.4M(16%) swapped_out_or_unallocated=748.4M(84%)
Writable regions: Total=71.3M written=3953K(5%) resident=10.9M(15%) swapped_out=0K(0%) unallocated=60.4M(85%)
==== Writable regions for process 34931
ReadOnly portion of Libraries: Total=890.9M resident=142.4M(16%) swapped_out_or_unallocated=748.4M(84%)
Writable regions: Total=71.3M written=3953K(5%) resident=10.9M(15%) swapped_out=0K(0%) unallocated=60.4M(85%)


  Main:
==== Writable regions for process 33259
ReadOnly portion of Libraries: Total=890.9M resident=142.3M(16%) swapped_out_or_unallocated=748.6M(84%)
Writable regions: Total=590.7M written=4865K(1%) resident=12.0M(2%) swapped_out=0K(0%) unallocated=578.7M(98%)
==== Writable regions for process 33259
ReadOnly portion of Libraries: Total=890.9M resident=142.3M(16%) swapped_out_or_unallocated=748.6M(84%)
Writable regions: Total=590.7M written=4865K(1%) resident=12.0M(2%) swapped_out=0K(0%) unallocated=578.7M(98%)
==== Writable regions for process 33259
ReadOnly portion of Libraries: Total=890.9M resident=142.3M(16%) swapped_out_or_unallocated=748.6M(84%)
Writable regions: Total=590.7M written=4865K(1%) resident=12.0M(2%) swapped_out=0K(0%) unallocated=578.7M(98%)
==== Writable regions for process 33259
ReadOnly portion of Libraries: Total=890.9M resident=142.3M(16%) swapped_out_or_unallocated=748.6M(84%)
Writable regions: Total=590.7M written=4865K(1%) resident=12.0M(2%) swapped_out=0K(0%) unallocated=578.7M(98%)
==== Writable regions for process 33259
ReadOnly portion of Libraries: Total=890.9M resident=142.3M(16%) swapped_out_or_unallocated=748.6M(84%)
Writable regions: Total=590.7M written=4865K(1%) resident=12.0M(2%) swapped_out=0K(0%) unallocated=578.7M(98%)
==== Writable regions for process 33259
ReadOnly portion of Libraries: Total=890.9M resident=142.3M(16%) swapped_out_or_unallocated=748.6M(84%)
Writable regions: Total=590.7M written=4865K(1%) resident=12.0M(2%) swapped_out=0K(0%) unallocated=578.7M(98%)
==== Writable regions for process 33259
ReadOnly portion of Libraries: Total=890.9M resident=142.3M(16%) swapped_out_or_unallocated=748.6M(84%)
Writable regions: Total=590.7M written=4865K(1%) resident=12.0M(2%) swapped_out=0K(0%) unallocated=578.7M(98%)
==== Writable regions for process 33259
ReadOnly portion of Libraries: Total=890.9M resident=142.3M(16%) swapped_out_or_unallocated=748.6M(84%)
Writable regions: Total=590.7M written=4865K(1%) resident=12.0M(2%) swapped_out=0K(0%) unallocated=578.7M(98%)
==== Writable regions for process 33259
ReadOnly portion of Libraries: Total=890.9M resident=142.6M(16%) swapped_out_or_unallocated=748.3M(84%)
Writable regions: Total=590.7M written=4865K(1%) resident=12.0M(2%) swapped_out=0K(0%) unallocated=578.7M(98%)
==== Writable regions for process 33259
ReadOnly portion of Libraries: Total=890.9M resident=142.7M(16%) swapped_out_or_unallocated=748.2M(84%)
Writable regions: Total=590.7M written=4865K(1%) resident=12.0M(2%) swapped_out=0K(0%) unallocated=578.7M(98%)

@Fangliding
Copy link
Member

这个pr后 110592 kB
这个pr前 106600 kB
最新release(无mmap) 113368 kB
ps: 数值可能有个位数百分比的浮动
mmap确实带来了一点点提升 不够这个似乎是负作用或者没作用((

@hossinasaadi
Copy link
Contributor Author

这个pr后 110592 kB 这个pr前 106600 kB 最新release(无mmap) 113368 kB ps: 数值可能有个位数百分比的浮动 mmap确实带来了一点点提升 不够这个似乎是负作用或者没作用((

Intresting, but on iOS, the memory improvement is clearly visible. 🤔

@Fangliding
Copy link
Member

Fangliding commented Dec 31, 2025

btw mmap的pr后静置内存似乎有增加(?
最新release 42 MB
mmap 后 47 MB
该pr后 49 MB
可能是一些乱七八糟的gc问题

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.

2 participants