aitorzip / DeepGTAV

A plugin for GTAV that transforms it into a vision-based self-driving car research environment.
GNU General Public License v3.0
1.12k stars 274 forks source link

Memory leak with RapidJSON library #72

Open sibojia opened 7 years ago

sibojia commented 7 years ago

There is a memory leak for about 0.2MB when the rate is set to 30Hz. After some debugging I found that it is with the json message construction. Commenting out the json code and leaving all the ScriptHook codes will make the leak disappear. I guess it has something to do with the "Allocator" of the RapidJSON library, but can not find a solution. Anyone has the same problem?

dominikandreas commented 6 years ago

I can confirm this and it's much worse when streaming big lists (like lots of vehicles and pedestrians). I don't know how to fix this for RapidJSON unfortunately. It would probably be a good idea to replace RapidJSON with protobuf or flatbuffers. The latter looks particularly interesting, but haven't tried it so far.