CodeAndWeb / PhysicsEditor-Loaders

Use these classes to load the plist/xml file written by PhysicsEditor
39 stars 21 forks source link

Fixed memory leaks #9

Closed Rubonnek closed 7 years ago

Rubonnek commented 7 years ago

Currently valgrind is reporting a memory leak when loading bodies from file:

==11949== LEAK SUMMARY:
==11949==    definitely lost: 288 bytes in 3 blocks
==11949==    indirectly lost: 488 bytes in 10 blocks
==11949==      possibly lost: 1,352 bytes in 18 blocks
==11949==    still reachable: 112,392 bytes in 983 blocks
==11949==                       of which reachable via heuristic:
==11949==                         newarray           : 1,536 bytes in 16 blocks
==11949==         suppressed: 0 bytes in 0 blocks

There's also no need to use cocos2d::Vector, nor cocos2d::Map. Using std::vector and std::map is enough. Unnecessary whitespace was also removed.

Here's the final valgrind report after this change which is normal for an empty cocos2d-x project:

==13917== LEAK SUMMARY:
==13917==    definitely lost: 0 bytes in 0 blocks
==13917==    indirectly lost: 0 bytes in 0 blocks
==13917==      possibly lost: 1,352 bytes in 18 blocks
==13917==    still reachable: 112,392 bytes in 983 blocks