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

HHH-19005 Memory leak modify String to StringBuilder #9545

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

fantasticfinger
Copy link

@fantasticfinger fantasticfinger commented Jan 3, 2025

https://hibernate.atlassian.net/browse/HHH-19005

Hello.

When It is json, there are some memory leak.

These are the results of the modified code and the existing code when tested locally.
image

In the case above, there is no problem elsewhere, but the problem occurs at the point where JSON data is encountered after VALUES. From this point on, a String is created in the above code for all tokenized JSON data, creating a memory leak. This means that the larger the JSON, the more leaks it will create.

This problem doesn't normally occur, but it makes a difference if you are performing json. This occurs when tokenizing json and formatting it while passing the switch statement within the perform method. Therefore, it seems better to change this code to StringBuilder as shown below.


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license
and can be relicensed under the terms of the LGPL v2.1 license in the future at the maintainers' discretion.
For more information on licensing, please check here.


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.

1 participant