-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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
ASAN detects memory leaks #2865
Comments
Strangely, I cannot reproduce the issue with GCC on macOS (tried 9.4.0 and 11.1.0). |
I could reproduce the leaks running Linux with both GCC and Clang. |
This code assumes that
|
@nlohmann This
which I assume was the original use, and the second is |
I added some assertions |
PR #2872 fixes this issue. Feedback is welcome! |
Just tried ecaac22, works for me! |
What is the issue you have?
I found memory leaks with ASAN.
Can you provide a small but working code example?
First case
Second case
What is the expected behavior?
No leak
And what is the actual behavior instead?
First case
Second case
Which compiler and operating system are you using?
Compile with:
g++ -o hello-json main.cpp -O0 -I/path/to/nlohmann/json/library -g3 -Wno-useless-cast -Wno-conversion -fno-omit-frame-pointer -fsanitize=address -lasan
Run with:
LD_PRELOAD=/usr/lib/gcc/x86_64-linux-gnu/8/libasan.so ./hello-json
Which version of the library did you use?
develop
branchThe text was updated successfully, but these errors were encountered: