Potential memory leak detected by Valgrind #1713
Labels
kind: bug
solution: proposed fix
a fix for the issue has been proposed and waits for confirmation
state: stale
the issue has not been updated in a while and will be closed automatically soon unless it is updated
What is the issue you have?
I encountered a weird memory leak in my code, when returning
nlohmann::json
object from my function, if function returning the object (of any type) throws then 32 bytes are leaked.This only happens on GCC, doesn't happen on Clang.
Please describe the steps to reproduce the issue. Can you provide a small but working code example?
Code:
json-valgrind.cpp
build:
run:
What is the expected behavior?
Valgrind exits saying that
definitely lost: 0 bytes in 0 blocks
And what is the actual behavior instead?
Valgrind exits saying that
definitely lost: 32 bytes in 1 blocks
Which compiler and operating system are you using? Is it a supported compiler?
Tested on Manjaro Linux with:
Did you use a released version of the library or the version from the
develop
branch?Tested with release 3.7.0 and 3.5.0
I wonder if this is nlohmann/json bug or GCC bug, since it doesn't happen on Clang
The text was updated successfully, but these errors were encountered: