Files
shorebird-updater/cspell.config.yaml
T
Eric Seidel 8649c75206 perf: mmap libapp.so out of the APK instead of buffering in RAM (#354)
* perf: mmap libapp.so out of the APK instead of buffering in RAM

`open_base_lib` previously read the entire decompressed libapp.so into a
Vec<u8> via `read_to_end` and handed bipatch a Cursor over that buffer.
For large apps libapp.so can be tens of megabytes, and that allocation
happens immediately after the patch download is buffered to disk — a
plausible OOM trigger on memory-constrained devices (we have at least
one customer report on OnePlus where the patch install appears to halt
silently right after the download completes).

Modern AGP (3.6+) defaults to extractNativeLibs=false, which keeps
libapp.so STORED uncompressed inside the APK so the dynamic linker can
mmap it directly. When that's the case, do the same: find the entry's
data offset via the zip crate, drop the archive, reopen the APK, and
mmap the entry's slice. Cursor<Mmap> implements Read + Seek, which is
what bipatch's `Reader::new(patch, base)` requires.

When the entry isn't stored uncompressed (older builds, or builds that
explicitly compress native libs), fall back to the previous buffered
read so we always succeed.

Mmap doesn't change the peak working set when bipatch traverses the
whole base linearly, but file-backed mappings are clean and reclaimable
under memory pressure where an anonymous Vec is not, and we avoid the
~2x transient allocation peak from `read_to_end` growing the buffer.

Tests cover both paths (stored → mmap, deflated → buffered) on the host.

* ci: add mmap, memmap, SIGBUS to cspell dictionary
2026-05-05 17:33:22 -07:00

99 lines
1.3 KiB
YAML

$schema: https://raw.githubusercontent.com/streetsidesoftware/cspell/main/cspell.schema.json
version: "0.2"
ignorePaths:
- target
- build
- "**/*.g.dart"
# Flutter platform directories with per-platform build files
- windows
- macos
- linux
- ios
- android
words:
- aarch
- androideabi
- apks
- armeabi
- armv7
- autogen
- bidiff
- bipatch
- bootable
- buildlog
- buildroot
- bundletool
- carryforward
- cbindgen
- cdylib
- classpath
- clippy
- codegen
- comde
- compatch
- Condvar
- datadir
- debuginfo
- declspec
- Decompressor
- dllexport
- dlopen
- EDQUOT
- EACCES
- embedders
- EOCD
- endtemplate
- ENOSPC
- EROFS
- eseidel
- ffigen
- gclient
- hdpi
- ifdef
- libapp
- libc
- libflutter
- libupdater
- logcat
- memmap
- mmap
- mockall
- mocktail
- msvc
- nscloud
- oslog
- pubspec
- repr
- reqwest
- rlib
- rsplit
- rollouts
- RTLD
- rustflags
- rustls
- rustup
- serde
- shorebirdtech
- SIGBUS
- sigstore
- staticlib
- subosito
- swiftpm
- symbolication
- ureq
- unbootable
- unbooted
- unreviewable
- unwritable
- usize
- Swatinem
- taiki
- Verdana
- vmcode
- withf
- xlink
- zstandard
- zstd
- xcodeproj
- pbxproj