Problem
Sentry's static initializer creates globalScope = new Scope(SentryOptions.empty()) (sentry/src/main/java/io/sentry/Sentry.java:68) at class-load time — a complete SentryOptions (sub-options objects, ~10 concurrent collections, plus the two default integrations added in the ctor) and a full Scope (preallocated breadcrumb ring, ~14 collections, locks). All of it is superseded moments later when Sentry.init calls globalScope.replaceOptions(options) (Sentry.java:337).
Under auto-init this allocation happens on the main thread at ContentProvider time, before Application.onCreate.
Proposal
Use a shared minimal/immutable empty-options singleton, or defer globalScope construction until first access (lazy holder). Pure allocation win at class-load; combine with the lazy sub-options investigation.
Constraints
SentryOptions.empty() semantics: some code paths rely on a mutable options instance pre-init (e.g. globalScope observers?); audit Scope usage before replaceOptions.
Problem
Sentry's static initializer createsglobalScope = new Scope(SentryOptions.empty())(sentry/src/main/java/io/sentry/Sentry.java:68) at class-load time — a completeSentryOptions(sub-options objects, ~10 concurrent collections, plus the two default integrations added in the ctor) and a fullScope(preallocated breadcrumb ring, ~14 collections, locks). All of it is superseded moments later whenSentry.initcallsglobalScope.replaceOptions(options)(Sentry.java:337).Under auto-init this allocation happens on the main thread at ContentProvider time, before
Application.onCreate.Proposal
Use a shared minimal/immutable empty-options singleton, or defer
globalScopeconstruction until first access (lazy holder). Pure allocation win at class-load; combine with the lazy sub-options investigation.Constraints
SentryOptions.empty()semantics: some code paths rely on a mutable options instance pre-init (e.g.globalScopeobservers?); auditScopeusage beforereplaceOptions.