Page MenuHomePhabricator

memory leak in module system
Closed, ResolvedPublic

Description

found while investigating a test with valgrind:
valgrind -v --leak-check=full ./MitkIGTTestDriver mitkNavigationToolReaderAndWriterTest

found a lot of definite losses:

17763== 1,060 (8 direct, 1,052 indirect) bytes in 1 blocks are definitely lost in loss record 154 of 166

17763== at 0x4C27CC1: operator new(unsigned long) (vg_replace_malloc.c:261)

17763== by 0x71FAD75: mitk::ModuleRegistry::Register(mitk::ModuleInfo*) (mitkModuleRegistry.cpp:90)

17763== by 0x4F882EA: mitk::ModuleInitializer::Register() (MitkIGT_init.cpp:52)

17763== by 0x4F8827E: mitk::ModuleInitializer::ModuleInitializer() (MitkIGT_init.cpp:47)

17763== by 0x4F88042: __static_initialization_and_destruction_0(int, int) (MitkIGT_init.cpp:75)

17763== by 0x4F88074: global constructors keyed to MitkIGT_init.cpp (MitkIGT_init.cpp:75)

17763== by 0x4F88395: ??? (in /local/muellerm/mitk-git/bugsquashing/bin/MITK-superbuild/MITK-build/bin/libMitkIGT.so)

17763== by 0x4ED789A: ??? (in /local/muellerm/mitk-git/bugsquashing/bin/MITK-superbuild/MITK-build/bin/libMitkIGT.so)

17763== by 0x7FF00072A: ???

maybe the static modules map does not get destroyed properly

Event Timeline

problem is the instatiation of a Module on the heap with new. the map is deleted regularly but the reserved memory for the Module objects inside the map is not freed