Closed dougmencken closed 6 months ago
==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 https://github.com/dougmencken/HeadOverHeels/commit/0b07d501c0c504b094eeff99abff29e8d86ca0ad
So now everyone knows about valgrind... okay 😏
here's how to