Skip to content

Conversation

@jamescrosswell
Copy link
Collaborator

@jamescrosswell jamescrosswell commented Sep 18, 2023

#skip-changelog

Related to #2607 (comment)

In applications that use breadcrumbs heavily, the biggest memory hog is Dictionary<string,object?>. The following is a snapshot from a memory profile of an app that's creating lots of breadcrumbs:
image

Most of those are unnecessarily created by the Hint constructor. By delaying instatiation of Hint.Items until they're actually used, we can avoid most allocations.

Results

Saves about (752B - 672B) / 752B = 10.64% of memory allocated for breadcrumbs.

Note: The savings scale linearly from individual breadcrumbs to hundreds of breadcrumbs (although savings for breadcrumbs in particular will be capped per Transaction by SentryOptions.MaxBreadcrumbs.

Before

image

After

image

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.

3 participants