dougmencken / HeadOverHeels

The free and open source remake of the game “Head over Heels”

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

've you ever tried to valgrind ?

dougmencken opened this issue · comments

here's how to

valgrind --tool=memcheck --leak-check=yes bin/headoverheels
==124529== Mismatched free() / delete / delete []
==124529==    at 0x4846AFF: operator delete(void*, unsigned long) (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==124529==    by 0x1AF705: iso::Room::~Room() (Room.cpp:154)
==124529==    by 0x1B002C: iso::Room::~Room() (Room.cpp:174)
==124529==    by 0x19947E: iso::MapManager::clear() (MapManager.cpp:35)
==124529==    by 0x177FF9: game::GameManager::cleanUp() (GameManager.cpp:71)
==124529==    by 0x12347C: main (main.cpp:228)
==124529==  Address 0xbee6770 is 0 bytes inside a block of size 252 alloc'd
==124529==    at 0x4845283: operator new[](unsigned long) (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==124529==    by 0x1B124E: iso::Room::Room(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int, unsigned int, unsigned int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) (Room.cpp:40)
==124529==    by 0x1A6E40: iso::RoomBuilder::buildRoom(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) (RoomBuilder.cpp:99)
==124529==    by 0x19E9E8: iso::MapManager::getOrBuildRoomByFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) (MapManager.cpp:783)
==124529==    by 0x18D153: iso::Miniature::calculatePositionOfConnectedMiniature(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned short) (Miniature.cpp:800)
==124529==    by 0x193B34: iso::Isomot::updateMe() (Isomot.cpp:295)
==124529==    by 0x182053: game::GameManager::update() (GameManager.cpp:139)
==124529==    by 0x20C094: gui::ContinueGame::doAction() (ContinueGame.cpp:34)
==124529==    by 0x1FC2C4: doIt (Action.hpp:33)
==124529==    by 0x1FC2C4: handleKey (Label.cpp:91)
==124529==    by 0x1FC2C4: gui::Label::handleKey(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) (Label.cpp:87)
==124529==    by 0x1FB1F3: gui::GuiManager::begin() (GuiManager.cpp:101)
==124529==    by 0x12346F: main (main.cpp:222)
==124529== 

this tool also helped me to dive into the reason of “ the game crashes on the second play(because the descriptions of items are deleted and re-read) problem which has been (re)solved with 0b07d50

So now everyone knows about valgrind... okay 😏