Jump to content

[SOLVED] Lots of errors reported by Valgrind


photo

Recommended Posts

Background:

 

We do both somewhat regular valgrind runs to check for any uncaught issues not yet causing problems as well as specific runs for those (very) hard-to-find bugs.

 

Currently I am using the Valley demo as quick test environment for some other work and had some weird behavior in my program, pointing to memory corruption. Cue a (first) valgrind run.

 

However running the valley demo through valgrind results in lots and lots of errors: "ERROR SUMMARY: 5179 errors from 100 contexts"

 

This is rather undesirable as in all likelihood about 5000+ probably have nothing to do with my issue..

 

 

From the valgrind output it looks like most errors have the same or similar cause, so fixing them should hopefully not be too herculean a task.

 

Most of them are occurences of:

==15475== Conditional jump or move depends on uninitialised value(s)
==15475==    at 0x5792A28: WorldBoundBox::compare(WorldBoundBox const&) const (MathLib.h:402)
==15475==    by 0x57C7D1E: WorldPosition::update() (WorldBounds.h:164)
==15475==    by 0x5762357: Node::update_world_position() (Node.cpp:688)
==15475==    by 0x5A7B099: ObjectMeshClutter::update_bounds() (ObjectMeshClutter.cpp:1656) 
==15475==    by 0x5A6AD0D: ObjectMeshClutter::clear_cells() (ObjectMeshClutter.cpp:159)
==15475==    by 0x5A6AE2E: ObjectMeshClutter::setOrientation(int) (ObjectMeshClutter.cpp:176)
==15475==    by 0x5A69CD5: ObjectMeshClutter::ObjectMeshClutter() (ObjectMeshClutter.cpp:56)
==15475==    by 0x5A840D1: FactoryCreator<Node, ObjectMeshClutter>::create() const (Factory.h:50)
==15475==    by 0x576839B: Factory<Node>::create(int) (Factory.h:70)
==15475==    by 0x575FD92: Node::createNode(int) (Node.cpp:245)
==15475==    by 0x575FE4C: Node::createNode(char const*) (Node.cpp:253)  
==15475==    by 0x5775DB8: Editor::load_world(Xml const*, int, int&) (Editor.cpp:817)
==15475==  Uninitialised value was created by a heap allocation
==15475==    at 0x4C2C27B: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==15475==    by 0x5079A73: Memory::systemAllocate(unsigned long) (Memory.cpp:1541)
==15475==    by 0x50769C0: HeapPool::init(unsigned long) (Memory.cpp:595)  
==15475==    by 0x507731D: HeapAllocator::allocate(unsigned long, unsigned long) (Memory.cpp:800)
==15475==    by 0x5078DB1: Allocator::medium_allocate(unsigned long) (Memory.cpp:1321)
==15475==    by 0x5079113: Allocator::allocate(unsigned long) (Memory.cpp:1386)
==15475==    by 0x5079AF4: Memory::allocate(unsigned long) (Memory.cpp:1556)
==15475==    by 0x512CD7C: CPUThread::CPUThread() (Memory.h:67)
==15475==    by 0x512D312: CPUExt::init(int) (CPUExt.cpp:231)
==15475==    by 0x4FD8516: Engine::init(char const*, char const*, int, char**, char const*, char const*) (Engine.cpp:572)
==15475==    by 0x4FD7C5F: Engine::Engine(App*, char const*, char const*, int, char**, char const*, char const*) (Engine.cpp:437)
==15475==    by 0x5018017: Unigine::EngineInterface::EngineInterface(App*, char const*, char const*, int, char**, char const*, char const*) (Unigine.cpp:129)

==15475== Conditional jump or move depends on uninitialised value(s)
==15475==    at 0x5409CA2: Grass::update_bounds() (MathLib.h:858)
==15475==    by 0x5409286: Grass::clear() (Grass.cpp:98)
==15475==    by 0x5411522: Grass::setDensity(float) (Grass.cpp:891)
==15475==    by 0x5408CE9: Grass::Grass() (Grass.cpp:63)
==15475==    by 0x622E54D: GLGrass::GLGrass() (GLGrass.cpp:30)
==15475==    by 0x620532B: GLRenderManager::create_grass() const (GLRenderManager.cpp:117)
==15475==    by 0x5D4AF19: RenderManager::createGrass() const (RenderManager.cpp:1555)
==15475==    by 0x5ACE172: ObjectGrass::ObjectGrass() (ObjectGrass.cpp:492)
==15475==    by 0x5AD77AD: FactoryCreator<Node, ObjectGrass>::create() const (Factory.h:50)
==15475==    by 0x576839B: Factory<Node>::create(int) (Factory.h:70)
==15475==    by 0x575FD92: Node::createNode(int) (Node.cpp:245)
==15475==    by 0x575FE4C: Node::createNode(char const*) (Node.cpp:253)
==15475==  Uninitialised value was created by a heap allocation
==15475==    at 0x4C2C27B: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==15475==    by 0x5079A73: Memory::systemAllocate(unsigned long) (Memory.cpp:1541)
==15475==    by 0x50769C0: HeapPool::init(unsigned long) (Memory.cpp:595)
==15475==    by 0x507731D: HeapAllocator::allocate(unsigned long, unsigned long) (Memory.cpp:800)
==15475==    by 0x5078C7B: Allocator::small_allocate(unsigned long) (Memory.cpp:1293)
==15475==    by 0x50790D1: Allocator::allocate(unsigned long) (Memory.cpp:1383)
==15475==    by 0x5079AF4: Memory::allocate(unsigned long) (Memory.cpp:1556)
==15475==    by 0x4FE3D85: Vector<String, int>::allocate(int) (Memory.h:67)
==15475==    by 0x4FD8040: Engine::init(char const*, char const*, int, char**, char const*, char const*) (Engine.cpp:496)
==15475==    by 0x4FD7C5F: Engine::Engine(App*, char const*, char const*, int, char**, char const*, char const*) (Engine.cpp:437)
==15475==    by 0x5018017: Unigine::EngineInterface::EngineInterface(App*, char const*, char const*, int, char**, char const*, char const*) (Unigine.cpp:129)
==15475==    by 0x5017A9E: Unigine::Engine::init(int, int, char**, char const*, char const*) (Unigine.cpp:208)

and

==15475== Conditional jump or move depends on uninitialised value(s)
==15475==    at 0x550D6EE: WidgetScroll::setValue(int) (WidgetScroll.cpp:85)
==15475==    by 0x550D38A: WidgetScroll::WidgetScroll(Gui*, int, int, int, int) (WidgetScroll.cpp:33)
==15475==    by 0x54AD297: WidgetScrollBox::WidgetScrollBox(Gui*, int, int) (WidgetScrollBox.cpp:37)
==15475==    by 0x5465EAD: UserInterface::parse_scrollbox(Xml const*, UserInterface::UIWidget*) (UserInterface.cpp:985)
==15475==    by 0x5462288: UserInterface::parse(Xml const*, UserInterface::UIWidget*) (UserInterface.cpp:387)
==15475==    by 0x5462D1B: UserInterface::parse_align(Xml const*, UserInterface::UIWidget*) (UserInterface.cpp:452)
==15475==    by 0x5462030: UserInterface::parse(Xml const*, UserInterface::UIWidget*) (UserInterface.cpp:375)
==15475==    by 0x5462A80: UserInterface::parse_font(Xml const*, UserInterface::UIWidget*) (UserInterface.cpp:436)
==15475==    by 0x5461FF4: UserInterface::parse(Xml const*, UserInterface::UIWidget*) (UserInterface.cpp:374)
==15475==    by 0x5464B2B: UserInterface::parse_vbox(Xml const*, UserInterface::UIWidget*) (UserInterface.cpp:872)
==15475==    by 0x54620E4: UserInterface::parse(Xml const*, UserInterface::UIWidget*) (UserInterface.cpp:380)
==15475==    by 0x5465DAD: UserInterface::parse_tabbox(Xml const*, UserInterface::UIWidget*) (UserInterface.cpp:978)
==15475==  Uninitialised value was created by a heap allocation
==15475==    at 0x4C2C27B: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==15475==    by 0x5079A73: Memory::systemAllocate(unsigned long) (Memory.cpp:1541)
==15475==    by 0x50769C0: HeapPool::init(unsigned long) (Memory.cpp:595)
==15475==    by 0x507731D: HeapAllocator::allocate(unsigned long, unsigned long) (Memory.cpp:800)
==15475==    by 0x5078C7B: Allocator::small_allocate(unsigned long) (Memory.cpp:1293)
==15475==    by 0x50790D1: Allocator::allocate(unsigned long) (Memory.cpp:1383)
==15475==    by 0x5079AF4: Memory::allocate(unsigned long) (Memory.cpp:1556)
==15475==    by 0x4FE3D85: Vector<String, int>::allocate(int) (Memory.h:67) 
==15475==    by 0x4FD8040: Engine::init(char const*, char const*, int, char**, char const*, char const*) (Engine.cpp:496)
==15475==    by 0x4FD7C5F: Engine::Engine(App*, char const*, char const*, int, char**, char const*, char const*) (Engine.cpp:437)
==15475==    by 0x5018017: Unigine::EngineInterface::EngineInterface(App*, char const*, char const*, int, char**, char const*, char const*) (Unigine.cpp:129)
==15475==    by 0x5017A9E: Unigine::Engine::init(int, int, char**, char const*, char const*) (Unigine.cpp:208)

Note I have only done runs on Valley and the widget button_00 sample (both logs attached, logs created with unmodified valley demo, no non-unigine code). Other demos might reveal other issues.

 

(valgrind run with "--trace-origins=yes --error-limit=no -v")

 

 

 

 

valgrind-output-valley.txt

valgrind-output-button-sample.txt

Link to comment
×
×
  • Create New...