You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The documentation here just tells us a string is returned, not how the memory management is done. By experimentation, I kind of figured out that there's no need to free the memory, which makes me suspect the memory is coupled to the obj parameter and freed as soon as the object is freed, but making this kind of things explicit would be welcome.
The text was updated successfully, but these errors were encountered:
Yes, you're right, the lifetime of the returned string is limited to the lifetime of the json_object. Actually, it's probably also freed if any other call to _to_json_string is made.
I'll try to dig up the details later today, but feel free to submit a pull request if you have a reasonable (and accurate) description you want added to the doc.
https://json-c.github.io/json-c/json-c-0.12.1/doc/html/json__object_8h.html#a1f62a660e2619559d1f3f54cd7483ff8
The documentation here just tells us a string is returned, not how the memory management is done. By experimentation, I kind of figured out that there's no need to free the memory, which makes me suspect the memory is coupled to the obj parameter and freed as soon as the object is freed, but making this kind of things explicit would be welcome.
The text was updated successfully, but these errors were encountered: