Skip to content

Commit edf70d6

Browse files
committed
Adopt 24 MiB mobile memory target
1 parent 299da9d commit edf70d6

4 files changed

Lines changed: 23 additions & 6 deletions

File tree

app/app/src/main/java/com/bringyour/network/DeviceManager.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class DeviceManager @Inject constructor(
2222
// provider share backing the client pair while providing is off. The
2323
// process-level Sdk.setMemoryLimit (MainApplication) sizes the
2424
// shared message pools and go soft limit separately.
25-
const val DEVICE_MEMORY_TARGET_BYTE_COUNT = 20L * 1024 * 1024
25+
const val DEVICE_MEMORY_TARGET_BYTE_COUNT = 24L * 1024 * 1024
2626
}
2727

2828
private val deviceLock = Any()

app/app/src/main/java/com/bringyour/network/MainApplication.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class MainApplication : Application() {
4040
const val VPN_STATE_BURST_COALESCE_MILLIS = 20L
4141
// Match the iOS packet-tunnel process budget so Android physical runs
4242
// expose the same SDK pressure/failure boundary. DeviceManager already
43-
// passes the matching iOS per-device target (20 MiB).
43+
// passes the matching iOS per-device steady target (24 MiB).
4444
const val SDK_PROCESS_MEMORY_LIMIT_MIB = 32L
4545
}
4646

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package com.bringyour.network
2+
3+
import org.junit.Assert.assertEquals
4+
import org.junit.Test
5+
6+
class MobileMemoryPolicyTest {
7+
@Test
8+
fun deviceUsesTwentyFourMiBSteadyTarget() {
9+
assertEquals(24L * 1024 * 1024, DeviceManager.DEVICE_MEMORY_TARGET_BYTE_COUNT)
10+
}
11+
}

app/scripts/PHYSICAL_LOWBAR.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,14 +94,15 @@ before/after values, aggregate mobile packet-pressure drops, primitive
9494
client/flow topology, platform transport-budget use, Android PSS, Java/native
9595
heaps, threads, descriptors, route state, and aggregate carrier counters. The
9696
steady streamline signal is `goRuntimeBytes`:
97-
five quiet connected minutes should have p50 and p95 at or below 20 MiB. Keep
97+
five quiet connected minutes after burst ownership drains should have p50 and
98+
p95 at or below 24 MiB. Keep
9899
the active peak and time-to-recover separate, and investigate every sample over
99100
the 28-MiB active diagnostic threshold. Neither threshold is Android whole-app
100101
PSS or an iOS Network Extension `phys_footprint` ceiling.
101102

102103
Ordinary Android and Apple SDK libraries start the Go runtime with
103-
`memprofilerate=0`. Android and iOS also use the same `GOGC=10` pacing for the
104-
20-MiB campaign; a looser Android heap float is not a valid surrogate for the
104+
`memprofilerate=0`. Android and iOS also use the same `GOGC=25` pacing for the
105+
24-MiB campaign; a looser Android heap float is not a valid surrogate for the
105106
iOS Network Extension. A private diagnostic build can opt in before native
106107
runtime initialization with `-PurnetworkMemoryProfileRateBytes=65536`; the
107108
Gradle value is passed to both the AAR linker and the diagnostic app API.
@@ -115,10 +116,15 @@ mobile reclaimer waits for payload quiet and bounded outstanding ownership,
115116
then performs at most one pass per cooldown; use its deferred, below-target,
116117
cooldown, and before/after counters to distinguish policy from a leak.
117118
`packetPressureDropCount` is a cumulative overload counter, not a pool leak:
118-
the <=20-MiB mobile profile samples packet-root ownership every fourth ingress
119+
the <=24-MiB mobile profile samples packet-root ownership every fourth ingress
119120
call below pressure, rejects a complete native ingress batch at 512 or more
120121
roots, and samples every call until ownership drains. Rejected batch ownership
121122
is returned immediately; TCP retransmission/backpressure provides recovery.
123+
The accepted performance profile keeps the H3-safe 16-message sequence and
124+
16-packet/24-KiB group ceilings, fixes Auto quality/speed windows at 4/1, and
125+
retains a 512-KiB packet warm set after reclaim. Do not raise the aggregate
126+
gate or double the per-flow/group ceilings without repeating the explicit-H3
127+
28-MiB failure test; both experiments breached it on the physical surrogate.
122128
Server/default devices do not instantiate this gate. The same mobile profile
123129
retires inactive TCP flow state after three minutes so a closed browser burst
124130
does not preserve the desktop ten-minute graph throughout the five-minute

0 commit comments

Comments
 (0)