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 #4309: memory leaks in C++ runtime #4374

Closed
wants to merge 3 commits into from
Closed

Fix #4309: memory leaks in C++ runtime #4374

wants to merge 3 commits into from

Conversation

ghost
Copy link

@ghost ghost commented Aug 6, 2023

Static data of lexers and parsers will never be released, this will cause numerous memory leak prompts to appear after the program exits (see the logs in #4309).

This PR uses unique_ptr instead of raw pointer for static data to avoid this problem (the static data will be released automatically after the program exits).

@ghost ghost changed the title Fix antlr#4309: memory leaks in Cpp runtime caused by unreleased static data Fix #4309: memory leaks in Cpp runtime caused by unreleased static data Aug 6, 2023
@ghost ghost changed the title Fix #4309: memory leaks in Cpp runtime caused by unreleased static data Fix #4309: memory leaks in C++ runtime Aug 28, 2023
@ghost
Copy link
Author

ghost commented Aug 28, 2023

This also fixes memory leaks in ATNDeserializationOptions.

@SuperBigYB
Copy link

This modification has been tested with valgrind on Linux and no memory leaks were detected, whereas there were leaks before. It's very impressive, and I hope it can be merged into the main branch as soon as possible.

@ghost ghost closed this by deleting the head repository Feb 22, 2024
This pull request was closed.
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