Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix memory alloc bug when using trikot-graphql #215

Merged
merged 1 commit into from
Jan 11, 2024

Conversation

sdetilly
Copy link
Contributor

Description

The String.escapeForGraphql() extension function was creating countless String objects inside the "fold" loop.

Motivation and Context

In my app, the query was huge, which means that many many String objects were allocated and deallocated about 100ms later, triggering many garbage collecting events. In an older device with low RAM and/or processing power, this could noticeably freeze the UI (in my case, for about 8 seconds!)

How Has This Been Tested?

This fix was tested in my project. We no longer allocate many String objects, instead using a StringBuilder.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

@sdetilly sdetilly merged commit 816a7d9 into master Jan 11, 2024
1 check passed
@sdetilly sdetilly deleted the graphql_object_alloc_fix branch January 11, 2024 18:20
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