Skip to content

Lazy-allocate SentryOptions sub-options objects #5707

Description

@runningcode

Problem

Every SentryOptions eagerly constructs SentryReplayOptions, SentryFeedbackOptions, ExperimentalOptions, logs/metrics sub-options, ClientReportRecorder, etc. (field initializers + ctor in sentry/src/main/java/io/sentry/SentryOptions.java). This is paid even by throwaway instances:

  • the static globalScope uses SentryOptions.empty() (Sentry.java:68),
  • SentryPerformanceProvider builds a full options object just to deserialize the app-start profiling config (sentry-android-core/.../SentryPerformanceProvider.java:122).

Proposal

Investigate lazy holders for sub-options (allocate on first getter access). Manifest parsing touches several of them during init, so the win materializes mainly for secondary options instances and disabled features — measure the allocation delta with an ART allocation trace before committing.

Constraints

Metadata

Metadata

Assignees

No one assigned

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions