Skip to content

fix(android): reduce polyline update churn causing OOM#88

Merged
lodev09 merged 1 commit into
mainfrom
fix/polyline-oom-churn
Jul 14, 2026
Merged

fix(android): reduce polyline update churn causing OOM#88
lodev09 merged 1 commit into
mainfrom
fix/polyline-oom-churn

Conversation

@lodev09

@lodev09 lodev09 commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator

Summary

Fixes CONSUMER-APP-44Y — fatal OutOfMemoryError at syncPolylineView/PolylineAnimator.update (19 events, 15 users). Trivial allocations fail with the 256MB heap exhausted; the polyline sync path is the hottest allocator, hammered by redundant Binder transactions into the GMS renderer:

  • setWidth/setZIndex fired on every React commit even when unchanged (Polyline.setWidth is the literal crash frame)
  • poly.color set on every animation frame
  • Animation updates ran at display refresh — 120Hz devices doubled the churn
  • Dirty-check used identity (===), but Fabric delivers new list instances per commit — content-equal coordinates re-parceled the full route and re-applied up to 512 gradient spans

Changes:

  • Cap animation updates to ~60fps (MIN_UPDATE_INTERVAL_NANOS)
  • Move strokeWidth/zIndex into PolylineAnimator with change-guards
  • Guard per-frame poly.color in the single-color path (gradient path keeps the unconditional set — it clears stale spans, see fix(android): clear stale spans before setting polyline points #67)
  • Structural equality on coordinates/strokeColors dirty-checks

Per-frame cost drops from 3–4 Binder transactions @120hz to 1 (setPoints) @≤60Hz for the common solid-color animated route. Companion consumer-app fix gates the live-tracking trailing-position updates that drove commits 5×/s.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Test Plan

Screenshots / Videos

N/A

Checklist

  • I tested on iOS
  • I tested on Android
  • I tested on Web
  • I updated the documentation (if needed)

View with Codesmith Autofix with Codesmith
Need help on this PR? Tag /codesmith with what you need. Autofix is disabled.

@lodev09
lodev09 merged commit 3b8ec1d into main Jul 14, 2026
3 checks passed
@lodev09
lodev09 deleted the fix/polyline-oom-churn branch July 14, 2026 15:45
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.

1 participant