Closed D4N closed 4 years ago
Hi D4N, thanks for reporting this!
it's a GNU implementation of std::map.emplace()
is having this leak (when emplace-constructing a value from r-value reference). MacOS (and presumably Bsd) STL implementation does not have this leak/bug, so it's a bug in the GNU STL implementation only (which I find not the first time).
I'll try working around this issue by dodging std::map.emplace()
call and will do it via entry creating and then moving.
Okay, I've taken a closer look - good thing it's not an implementation error of emplace{}
call as I thought before.
After a deeper analysis it turned out to be a harmless side-effect of the swap
(-s
) operation. Leak indeed was produced but it was harmless: the nesting parts of a JSON tree after swapping with the nested JSON part were meant to be discarded anyways, but instead it was left "lingering in the air".
I'll push a fix soon, together with the fix for the other issue. Thank you again, D4N for catching and reporting those.
The following example from
User Guide.md
results in a memory leak: