You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was hit by another memory error. So I thought to try out valgrind. (Never used it before)
This time wasn't any crash. But valgrind found a couple of things.
Wyrmgus was compiled with -O1. (And still too slow on my laptop)
==22938== Memcheck, a memory error detector
==22938== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==22938== Using Valgrind-3.10.1 and LibVEX; rerun with -h for copyright info
==22938== Command: ./stratagus -d /repos/Wyrmsun
==22938== Parent PID: 2036
==22938==
==22938== Syscall param writev(vector[...]) points to uninitialised byte(s)
==22938== at 0x7B6252D: ??? (in /usr/lib/libc-2.21.so)
==22938== by 0x988BCCA: ??? (in /usr/lib/libxcb.so.1.1.0)
==22938== by 0x988C0C0: ??? (in /usr/lib/libxcb.so.1.1.0)
==22938== by 0x988C144: xcb_writev (in /usr/lib/libxcb.so.1.1.0)
==22938== by 0x69C918D: _XSend (in /usr/lib/libX11.so.6.3.0)
==22938== by 0x69C9681: _XReply (in /usr/lib/libX11.so.6.3.0)
==22938== by 0x69C511C: XSync (in /usr/lib/libX11.so.6.3.0)
==22938== by 0x54EC220: ??? (in /usr/lib/libSDL-1.2.so.0.11.4)
==22938== by 0x54EE502: ??? (in /usr/lib/libSDL-1.2.so.0.11.4)
==22938== by 0x54EE808: ??? (in /usr/lib/libSDL-1.2.so.0.11.4)
==22938== by 0x54DD574: SDL_SetVideoMode (in /usr/lib/libSDL-1.2.so.0.11.4)
==22938== by 0x570E02: InitVideoSdl() (sdl.cpp:635)
==22938== Address 0xf69f7a3 is 19 bytes inside a block of size 16,384 alloc'd
==22938== at 0x4C2C080: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==22938== by 0x69B94E1: XOpenDisplay (in /usr/lib/libX11.so.6.3.0)
==22938== by 0x54EEA5A: ??? (in /usr/lib/libSDL-1.2.so.0.11.4)
==22938== by 0x54DD265: SDL_VideoInit (in /usr/lib/libSDL-1.2.so.0.11.4)
==22938== by 0x54B6D4B: SDL_InitSubSystem (in /usr/lib/libSDL-1.2.so.0.11.4)
==22938== by 0x54B6DC3: SDL_Init (in /usr/lib/libSDL-1.2.so.0.11.4)
==22938== by 0x56EF82: InitVideoSdl() (sdl.cpp:471)
==22938== by 0x5729D7: InitVideo() (video.cpp:338)
==22938== by 0x50490C: stratagusMain(int, char**) (stratagus.cpp:753)
==22938== by 0x4EDC31: main (main.cpp:37)
==22938==
==22938== Conditional jump or move depends on uninitialised value(s)
==22938== at 0x4D7FCB: CostMoveTo (astar.cpp:592)
==22938== by 0x4D7FCB: AStarFindSimplePath (astar.cpp:901)
==22938== by 0x4D7FCB: AStarFindPath(Vec2T<short> const&, Vec2T<short> const&, int, int, int, int, int, int, char*, int, CUnit const&) (astar.cpp:933)
==22938== by 0x4D9AE9: NewPath (pathfinder.cpp:330)
==22938== by 0x4D9AE9: NextPathElement(CUnit&, short*, short*) (pathfinder.cpp:376)
==22938== by 0x462D59: DoActionMove(CUnit&) (action_move.cpp:165)
==22938== by 0x463112: COrder_Move::Execute(CUnit&) (action_move.cpp:270)
==22938== by 0x46F1C5: HandleUnitAction (actions.cpp:396)
==22938== by 0x46F1C5: UnitActionsEachCycle<__gnu_cxx::__normal_iterator<CUnit**, std::vector<CUnit*> > > (actions.cpp:487)
==22938== by 0x46F1C5: UnitActions() (actions.cpp:517)
==22938== by 0x4EE233: GameLogicLoop (mainloop.cpp:256)
==22938== by 0x4EE233: SingleGameLoop (mainloop.cpp:390)
==22938== by 0x4EE233: GameMainLoop() (mainloop.cpp:427)
==22938== by 0x49980E: StartMap(std::string const&, bool) (game.cpp:164)
==22938== by 0x5A459E: tolua_stratagus_StartMap00(lua_State*) (tolua.cpp:1063)
==22938== by 0x4E421E7: ??? (in /usr/lib/liblua5.1.so.5.1.5)
==22938== by 0x4E4C92E: ??? (in /usr/lib/liblua5.1.so.5.1.5)
==22938== by 0x4E4262C: ??? (in /usr/lib/liblua5.1.so.5.1.5)
==22938== by 0x4E4191A: ??? (in /usr/lib/liblua5.1.so.5.1.5)
==22938==
==22938== Conditional jump or move depends on uninitialised value(s)
==22938== at 0x4D7FDF: AStarFindSimplePath (astar.cpp:901)
==22938== by 0x4D7FDF: AStarFindPath(Vec2T<short> const&, Vec2T<short> const&, int, int, int, int, int, int, char*, int, CUnit const&) (astar.cpp:933)
==22938== by 0x4D9AE9: NewPath (pathfinder.cpp:330)
==22938== by 0x4D9AE9: NextPathElement(CUnit&, short*, short*) (pathfinder.cpp:376)
==22938== by 0x462D59: DoActionMove(CUnit&) (action_move.cpp:165)
==22938== by 0x463112: COrder_Move::Execute(CUnit&) (action_move.cpp:270)
==22938== by 0x46F1C5: HandleUnitAction (actions.cpp:396)
==22938== by 0x46F1C5: UnitActionsEachCycle<__gnu_cxx::__normal_iterator<CUnit**, std::vector<CUnit*> > > (actions.cpp:487)
==22938== by 0x46F1C5: UnitActions() (actions.cpp:517)
==22938== by 0x4EE233: GameLogicLoop (mainloop.cpp:256)
==22938== by 0x4EE233: SingleGameLoop (mainloop.cpp:390)
==22938== by 0x4EE233: GameMainLoop() (mainloop.cpp:427)
==22938== by 0x49980E: StartMap(std::string const&, bool) (game.cpp:164)
==22938== by 0x5A459E: tolua_stratagus_StartMap00(lua_State*) (tolua.cpp:1063)
==22938== by 0x4E421E7: ??? (in /usr/lib/liblua5.1.so.5.1.5)
==22938== by 0x4E4C92E: ??? (in /usr/lib/liblua5.1.so.5.1.5)
==22938== by 0x4E4262C: ??? (in /usr/lib/liblua5.1.so.5.1.5)
==22938== by 0x4E4191A: ??? (in /usr/lib/liblua5.1.so.5.1.5)
==22938==
==22938== Invalid read of size 4
==22938== at 0x486471: AiCheckingWork (ai_resource.cpp:882)
==22938== by 0x486471: AiResourceManager() (ai_resource.cpp:1535)
==22938== by 0x47D342: AiEachSecond(CPlayer&) (ai.cpp:1058)
==22938== by 0x4F1216: PlayersEachSecond(int) (player.cpp:1304)
==22938== by 0x4EE2FA: GameLogicLoop (mainloop.cpp:300)
==22938== by 0x4EE2FA: SingleGameLoop (mainloop.cpp:390)
==22938== by 0x4EE2FA: GameMainLoop() (mainloop.cpp:427)
==22938== by 0x49980E: StartMap(std::string const&, bool) (game.cpp:164)
==22938== by 0x5A459E: tolua_stratagus_StartMap00(lua_State*) (tolua.cpp:1063)
==22938== by 0x4E421E7: ??? (in /usr/lib/liblua5.1.so.5.1.5)
==22938== by 0x4E4C92E: ??? (in /usr/lib/liblua5.1.so.5.1.5)
==22938== by 0x4E4262C: ??? (in /usr/lib/liblua5.1.so.5.1.5)
==22938== by 0x4E4191A: ??? (in /usr/lib/liblua5.1.so.5.1.5)
==22938== by 0x4E427B9: ??? (in /usr/lib/liblua5.1.so.5.1.5)
==22938== by 0x4E3E57C: lua_pcall (in /usr/lib/liblua5.1.so.5.1.5)
==22938== Address 0xebe02d4 is 4 bytes inside a block of size 64 free'd
==22938== at 0x4C2B6D0: operator delete(void*) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==22938== by 0x486F53: deallocate (new_allocator.h:110)
==22938== by 0x486F53: deallocate (alloc_traits.h:386)
==22938== by 0x486F53: _M_deallocate (stl_vector.h:178)
==22938== by 0x486F53: void std::vector<AiBuildQueue, std::allocator<AiBuildQueue> >::_M_insert_aux<AiBuildQueue const&>(__gnu_cxx::__normal_iterator<AiBuildQueue*, std::vector<AiBuildQueue, std::allocator<AiBuildQueue> > >, AiBuildQueue const&) (vector.tcc:394)
==22938== by 0x4859F3: insert (vector.tcc:131)
==22938== by 0x4859F3: AiRequestSupply() (ai_resource.cpp:575)
==22938== by 0x486886: AiCheckingWork (ai_resource.cpp:879)
==22938== by 0x486886: AiResourceManager() (ai_resource.cpp:1535)
==22938== by 0x47D342: AiEachSecond(CPlayer&) (ai.cpp:1058)
==22938== by 0x4F1216: PlayersEachSecond(int) (player.cpp:1304)
==22938== by 0x4EE2FA: GameLogicLoop (mainloop.cpp:300)
==22938== by 0x4EE2FA: SingleGameLoop (mainloop.cpp:390)
==22938== by 0x4EE2FA: GameMainLoop() (mainloop.cpp:427)
==22938== by 0x49980E: StartMap(std::string const&, bool) (game.cpp:164)
==22938== by 0x5A459E: tolua_stratagus_StartMap00(lua_State*) (tolua.cpp:1063)
==22938== by 0x4E421E7: ??? (in /usr/lib/liblua5.1.so.5.1.5)
==22938== by 0x4E4C92E: ??? (in /usr/lib/liblua5.1.so.5.1.5)
==22938== by 0x4E4262C: ??? (in /usr/lib/liblua5.1.so.5.1.5)
==22938==
==22938== Invalid read of size 4
==22938== at 0x486474: AiCheckingWork (ai_resource.cpp:882)
==22938== by 0x486474: AiResourceManager() (ai_resource.cpp:1535)
==22938== by 0x47D342: AiEachSecond(CPlayer&) (ai.cpp:1058)
==22938== by 0x4F1216: PlayersEachSecond(int) (player.cpp:1304)
==22938== by 0x4EE2FA: GameLogicLoop (mainloop.cpp:300)
==22938== by 0x4EE2FA: SingleGameLoop (mainloop.cpp:390)
==22938== by 0x4EE2FA: GameMainLoop() (mainloop.cpp:427)
==22938== by 0x49980E: StartMap(std::string const&, bool) (game.cpp:164)
==22938== by 0x5A459E: tolua_stratagus_StartMap00(lua_State*) (tolua.cpp:1063)
==22938== by 0x4E421E7: ??? (in /usr/lib/liblua5.1.so.5.1.5)
==22938== by 0x4E4C92E: ??? (in /usr/lib/liblua5.1.so.5.1.5)
==22938== by 0x4E4262C: ??? (in /usr/lib/liblua5.1.so.5.1.5)
==22938== by 0x4E4191A: ??? (in /usr/lib/liblua5.1.so.5.1.5)
==22938== by 0x4E427B9: ??? (in /usr/lib/liblua5.1.so.5.1.5)
==22938== by 0x4E3E57C: lua_pcall (in /usr/lib/liblua5.1.so.5.1.5)
==22938== Address 0xebe02d0 is 0 bytes inside a block of size 64 free'd
==22938== at 0x4C2B6D0: operator delete(void*) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==22938== by 0x486F53: deallocate (new_allocator.h:110)
==22938== by 0x486F53: deallocate (alloc_traits.h:386)
==22938== by 0x486F53: _M_deallocate (stl_vector.h:178)
==22938== by 0x486F53: void std::vector<AiBuildQueue, std::allocator<AiBuildQueue> >::_M_insert_aux<AiBuildQueue const&>(__gnu_cxx::__normal_iterator<AiBuildQueue*, std::vector<AiBuildQueue, std::allocator<AiBuildQueue> > >, AiBuildQueue const&) (vector.tcc:394)
==22938== by 0x4859F3: insert (vector.tcc:131)
==22938== by 0x4859F3: AiRequestSupply() (ai_resource.cpp:575)
==22938== by 0x486886: AiCheckingWork (ai_resource.cpp:879)
==22938== by 0x486886: AiResourceManager() (ai_resource.cpp:1535)
==22938== by 0x47D342: AiEachSecond(CPlayer&) (ai.cpp:1058)
==22938== by 0x4F1216: PlayersEachSecond(int) (player.cpp:1304)
==22938== by 0x4EE2FA: GameLogicLoop (mainloop.cpp:300)
==22938== by 0x4EE2FA: SingleGameLoop (mainloop.cpp:390)
==22938== by 0x4EE2FA: GameMainLoop() (mainloop.cpp:427)
==22938== by 0x49980E: StartMap(std::string const&, bool) (game.cpp:164)
==22938== by 0x5A459E: tolua_stratagus_StartMap00(lua_State*) (tolua.cpp:1063)
==22938== by 0x4E421E7: ??? (in /usr/lib/liblua5.1.so.5.1.5)
==22938== by 0x4E4C92E: ??? (in /usr/lib/liblua5.1.so.5.1.5)
==22938== by 0x4E4262C: ??? (in /usr/lib/liblua5.1.so.5.1.5)
==22938==
==22938== Invalid read of size 4
==22938== at 0x45FC31: COrder_Build::Execute(CUnit&) (action_build.cpp:552)
==22938== by 0x46F1C5: HandleUnitAction (actions.cpp:396)
==22938== by 0x46F1C5: UnitActionsEachCycle<__gnu_cxx::__normal_iterator<CUnit**, std::vector<CUnit*> > > (actions.cpp:487)
==22938== by 0x46F1C5: UnitActions() (actions.cpp:517)
==22938== by 0x4EE233: GameLogicLoop (mainloop.cpp:256)
==22938== by 0x4EE233: SingleGameLoop (mainloop.cpp:390)
==22938== by 0x4EE233: GameMainLoop() (mainloop.cpp:427)
==22938== by 0x49980E: StartMap(std::string const&, bool) (game.cpp:164)
==22938== by 0x5A459E: tolua_stratagus_StartMap00(lua_State*) (tolua.cpp:1063)
==22938== by 0x4E421E7: ??? (in /usr/lib/liblua5.1.so.5.1.5)
==22938== by 0x4E4C92E: ??? (in /usr/lib/liblua5.1.so.5.1.5)
==22938== by 0x4E4262C: ??? (in /usr/lib/liblua5.1.so.5.1.5)
==22938== by 0x4E4191A: ??? (in /usr/lib/liblua5.1.so.5.1.5)
==22938== by 0x4E427B9: ??? (in /usr/lib/liblua5.1.so.5.1.5)
==22938== by 0x4E3E57C: lua_pcall (in /usr/lib/liblua5.1.so.5.1.5)
==22938== by 0x4EDB9E: LuaCallback::run(int) (luacallback.cpp:149)
==22938== Address 0x138ef2d8 is 40 bytes inside a block of size 56 free'd
==22938== at 0x4C2B6D0: operator delete(void*) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==22938== by 0x45FDF5: COrder_Build::~COrder_Build() (action_build.h:37)
==22938== by 0x45F978: COrder_Build::CheckCanBuild(CUnit&) (action_build.cpp:343)
==22938== by 0x45FADA: COrder_Build::Execute(CUnit&) (action_build.cpp:540)
==22938== by 0x46F1C5: HandleUnitAction (actions.cpp:396)
==22938== by 0x46F1C5: UnitActionsEachCycle<__gnu_cxx::__normal_iterator<CUnit**, std::vector<CUnit*> > > (actions.cpp:487)
==22938== by 0x46F1C5: UnitActions() (actions.cpp:517)
==22938== by 0x4EE233: GameLogicLoop (mainloop.cpp:256)
==22938== by 0x4EE233: SingleGameLoop (mainloop.cpp:390)
==22938== by 0x4EE233: GameMainLoop() (mainloop.cpp:427)
==22938== by 0x49980E: StartMap(std::string const&, bool) (game.cpp:164)
==22938== by 0x5A459E: tolua_stratagus_StartMap00(lua_State*) (tolua.cpp:1063)
==22938== by 0x4E421E7: ??? (in /usr/lib/liblua5.1.so.5.1.5)
==22938== by 0x4E4C92E: ??? (in /usr/lib/liblua5.1.so.5.1.5)
==22938== by 0x4E4262C: ??? (in /usr/lib/liblua5.1.so.5.1.5)
==22938== by 0x4E4191A: ??? (in /usr/lib/liblua5.1.so.5.1.5)
==22938==
==22938== Source and destination overlap in memcpy(0x12407d40, 0x12407d48, 120)
==22938== at 0x4C2EACD: memcpy@@GLIBC_2.14 (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==22938== by 0x4D93DF: AStarReplaceNode (astar.cpp:467)
==22938== by 0x4D93DF: AStarFindPath(Vec2T<short> const&, Vec2T<short> const&, int, int, int, int, int, int, char*, int, CUnit const&) (astar.cpp:1074)
==22938== by 0x4D9AE9: NewPath (pathfinder.cpp:330)
==22938== by 0x4D9AE9: NextPathElement(CUnit&, short*, short*) (pathfinder.cpp:376)
==22938== by 0x462D59: DoActionMove(CUnit&) (action_move.cpp:165)
==22938== by 0x465882: COrder_Resource::MoveToResource_Unit(CUnit&) (action_resource.cpp:447)
==22938== by 0x4659D7: COrder_Resource::MoveToResource(CUnit&) (action_resource.cpp:487)
==22938== by 0x467B94: COrder_Resource::Execute(CUnit&) (action_resource.cpp:1427)
==22938== by 0x46F1C5: HandleUnitAction (actions.cpp:396)
==22938== by 0x46F1C5: UnitActionsEachCycle<__gnu_cxx::__normal_iterator<CUnit**, std::vector<CUnit*> > > (actions.cpp:487)
==22938== by 0x46F1C5: UnitActions() (actions.cpp:517)
==22938== by 0x4EE233: GameLogicLoop (mainloop.cpp:256)
==22938== by 0x4EE233: SingleGameLoop (mainloop.cpp:390)
==22938== by 0x4EE233: GameMainLoop() (mainloop.cpp:427)
==22938== by 0x49980E: StartMap(std::string const&, bool) (game.cpp:164)
==22938== by 0x5A459E: tolua_stratagus_StartMap00(lua_State*) (tolua.cpp:1063)
==22938== by 0x4E421E7: ??? (in /usr/lib/liblua5.1.so.5.1.5)
==22938==
==22938== Source and destination overlap in memcpy(0x12407d48, 0x12407d50, 112)
==22938== at 0x4C2EACD: memcpy@@GLIBC_2.14 (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==22938== by 0x4D93DF: AStarReplaceNode (astar.cpp:467)
==22938== by 0x4D93DF: AStarFindPath(Vec2T<short> const&, Vec2T<short> const&, int, int, int, int, int, int, char*, int, CUnit const&) (astar.cpp:1074)
==22938== by 0x4D9839: PlaceReachable(CUnit const&, Vec2T<short> const&, int, int, int, int) (pathfinder.cpp:190)
==22938== by 0x4D98BF: UnitReachable(CUnit const&, CUnit const&, int) (pathfinder.cpp:230)
==22938== by 0x550DB5: ComputeCost (unit_find.cpp:756)
==22938== by 0x550DB5: Find<__gnu_cxx::__normal_iterator<CUnit* const*, std::vector<CUnit*> > > (unit_find.cpp:724)
==22938== by 0x550DB5: Find (unit_find.cpp:708)
==22938== by 0x550DB5: AttackUnitsInDistance(CUnit const&, int, CUnitFilter) (unit_find.cpp:1203)
==22938== by 0x551089: AttackUnitsInReactRange(CUnit const&, CUnitFilter) (unit_find.cpp:1241)
==22938== by 0x55109A: AttackUnitsInReactRange(CUnit const&) (unit_find.cpp:1246)
==22938== by 0x45D565: COrder_Attack::CheckForTargetInRange(CUnit&) (action_attack.cpp:372)
==22938== by 0x45E0CF: COrder_Attack::Execute(CUnit&) (action_attack.cpp:685)
==22938== by 0x46F1C5: HandleUnitAction (actions.cpp:396)
==22938== by 0x46F1C5: UnitActionsEachCycle<__gnu_cxx::__normal_iterator<CUnit**, std::vector<CUnit*> > > (actions.cpp:487)
==22938== by 0x46F1C5: UnitActions() (actions.cpp:517)
==22938== by 0x4EE233: GameLogicLoop (mainloop.cpp:256)
==22938== by 0x4EE233: SingleGameLoop (mainloop.cpp:390)
==22938== by 0x4EE233: GameMainLoop() (mainloop.cpp:427)
==22938== by 0x49980E: StartMap(std::string const&, bool) (game.cpp:164)
==22938==
==22938==
==22938== HEAP SUMMARY:
==22938== in use at exit: 189,120,979 bytes in 71,247 blocks
==22938== total heap usage: 24,794,636 allocs, 24,723,389 frees, 1,819,493,720 bytes allocated
==22938==
==22938== LEAK SUMMARY:
==22938== definitely lost: 3,444,408 bytes in 610 blocks
==22938== indirectly lost: 18,451,365 bytes in 7,013 blocks
==22938== possibly lost: 10,845,378 bytes in 11,314 blocks
==22938== still reachable: 156,379,828 bytes in 52,310 blocks
==22938== suppressed: 0 bytes in 0 blocks
==22938== Rerun with --leak-check=full to see details of leaked memory
==22938==
==22938== For counts of detected and suppressed errors, rerun with: -v
==22938== Use --track-origins=yes to see where uninitialised values come from
==22938== ERROR SUMMARY: 26363 errors from 8 contexts (suppressed: 0 from 0)
The text was updated successfully, but these errors were encountered:
I was hit by another memory error. So I thought to try out valgrind. (Never used it before)
This time wasn't any crash. But valgrind found a couple of things.
Wyrmgus was compiled with -O1. (And still too slow on my laptop)
The text was updated successfully, but these errors were encountered: