kevinhughes27 / mupen64plus-input-bot

An input driver for mupen64plus that consumes from a python web server
191 stars 48 forks source link

Free the JSON object memory #10

Closed bzier closed 3 years ago

bzier commented 3 years ago

For context, see the conversation in https://github.com/bzier/gym-mupen64plus/issues/80 regarding the memory leak, investigation and resolution.

According to the docs for the json-c library,

When you are done with the tree of objects, you call json_object_put() on just the root object to free it, which recurses down through any child objects calling json_object_put() on each one of those in turn.

This change marks the JSON object we parsed to be freed and resolves the memory leak.