-
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
HELP! There is a memory leak in the code?! #2837
Comments
I have two questions: (1) How to release the memory consumption that has not been released? (2) Why is memory consumption so huge? |
This is the .msg file: 1.msg |
I didn't test with Valgrind or ASAN...I just monitoring CPU through my terminal. |
Note the overhead is much smaller if you compile your binary in release mode. |
Thank you for your reply! But when the test_json function exits, the CPU memory growth caused by it is not released! You can use the data and code above to reproduce it. We need your help! |
For an explanation of why memory freed by the application isn't returned to the OS: https://stackoverflow.com/questions/45538993/why-dont-memory-allocators-actively-return-freed-memory-to-the-os |
Thanks! It really helps a lot! |
I tested on different systems: Then I refered to #1924 , and it worked! I guess that different versions of the glibc lead to different memory recovery mechanisms. Thanks a lot! |
Do you need further assistance with this issue? |
Nope.Thanks! |
Discussed in https://github.com/nlohmann/json/discussions/2836
Originally posted by HuberyQ June 23, 2021
Sorry to attract you with such a scary title. First of all, I would like to thank you for this work!
I found that after parsing the. MSG file, I got the JSON object successfully, but the CPU memory was not released until the end of the program! Is there a mistake in the way I use it? Can you manually free up the consumed memory?
The size of the. MSG file is about 24MB, but the memory consumption of the parsing process is about 0.4G! Here is the test source code:
The text was updated successfully, but these errors were encountered: