Skip to content

perf(apple): Reduce native parser lifetimes - #733

Merged
jamieQ merged 2 commits into
mainfrom
perf/reduce-apple-parser-lifetimes
Nov 9, 2026
Merged

jamieQ merged 2 commits into
mainfrom
perf/reduce-apple-parser-lifetimes

Conversation

@jamieQ

@jamieQ jamieQ commented Nov 9, 2026 •

Copy link
Copy Markdown
Member

Two changes to reduce peak memory use while processing large apps in common cases:

  1. During signature validation, keep the mach-o parser in a local variable rather than on the validator instance so it's released before performing resource validation.
  2. During dSYM processing, move the symbol extraction into a helper function that returns python-owned data so the native parser can be released before grouping & demangling.

Both changes shorten the life of various LIEF objects that can consume substantial memory in larger apps.

Refs EME-1341

Keep the Mach-O parser local to executable validation and pass it explicitly
when checking the signature. This releases the native binary graph before
resource validation and subsequent analysis.
@sentry

sentry Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Size Analysis

2 components analyzed

iOS Builds

Name Configuration Version Download Size Install Size
HackerNews (iOS)
com.emergetools.hackernews
Release 3.8 (1) 6.5 MB (N/A) 9.7 MB (N/A)

Android Builds

Name Configuration Version Download Size Uncompressed Size
Hacker News (Android)
com.emergetools.hackernews
Release 1.0.2 (13) 2.9 MB (N/A) 6.6 MB (N/A)

Configure launchpad-test-ios status check rules

@sentry

sentry Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

📲 Install Builds

iOS

🔗 App Name App ID Version Configuration
HackerNews com.emergetools.hackernews 3.8 (1) Release

Android

🔗 App Name App ID Version Configuration
Hacker News com.emergetools.hackernews 1.0.2 (13) Release

⚙️ launchpad-test-android Build Distribution Settings

Extract Python-owned symbols in a helper so native parser references leave
scope before grouping and demangling. Materialize the results rather than
yielding to avoid retaining the parser in a suspended generator.
@jamieQ
jamieQ force-pushed the perf/reduce-apple-parser-lifetimes branch from 0f86020 to e62e94e Compare November 9, 2026 15:26
"binary_name": binary_info.name,
},
)
for arch_slice, slice_symbol_sizes in self._extract_dsym_symbols(

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that there is a tradeoff here where we're eagerly producing the symbols for multiple architectures up front rather than on-demand as we were previously doing. It's possible that that could have worse memory use performance, but from checking how prod data looks I don't think it will matter today, and the change is definitely helpful for large single-arch binaries.

@linear-code

linear-code Bot commented Nov 9, 2026

Copy link
Copy Markdown

EME-1341

@jamieQ
jamieQ marked this pull request as ready for review November 9, 2026 15:58
@jamieQ
jamieQ merged commit 063d1f0 into main Nov 9, 2026
25 checks passed
@jamieQ
jamieQ deleted the perf/reduce-apple-parser-lifetimes branch November 9, 2026 18:55
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