Memory leaks in UGGrid factory
When running the mcmgmappertest
executable with AddressSanitizer enabled, I get a lot of memory leaks. It seems to complain about the UGGrid factory not releasing a vector in ugDomain
=================================================================
==30661==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 8192 byte(s) in 1 object(s) allocated from:
#0 0x55a33a1d3539 in calloc (/home/sospinar/Codes/dune-sup-assembler/build-sospinar-optimized-clang18/dune-grid/dune/grid/common/test/RelWithDebInfo/mcmgmappertest+0xfe539) (BuildId: cd9f61db62a9b8dde8a8f191f2baaa0031158854)
#1 0x7f0b1ecde48d (<unknown module>)
Direct leak of 7680 byte(s) in 1 object(s) allocated from:
#0 0x55a33a21063d in operator new(unsigned long) (/home/sospinar/Codes/dune-sup-assembler/build-sospinar-optimized-clang18/dune-grid/dune/grid/common/test/RelWithDebInfo/mcmgmappertest+0x13b63d) (BuildId: cd9f61db62a9b8dde8a8f191f2baaa0031158854)
#1 0x55a33a62f759 in std::__new_allocator<Dune::UG::D3::linear_segment>::allocate(unsigned long, void const*) /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/new_allocator.h:137:27
#2 0x55a33a62f759 in std::allocator_traits<std::allocator<Dune::UG::D3::linear_segment>>::allocate(std::allocator<Dune::UG::D3::linear_segment>&, unsigned long) /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/alloc_traits.h:464:20
#3 0x55a33a62f759 in std::_Vector_base<Dune::UG::D3::linear_segment, std::allocator<Dune::UG::D3::linear_segment>>::_M_allocate(unsigned long) /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/stl_vector.h:378:20
#4 0x55a33a62f759 in void std::vector<Dune::UG::D3::linear_segment, std::allocator<Dune::UG::D3::linear_segment>>::_M_realloc_insert<unsigned int&, int, int (&) [4], std::array<Dune::FieldVector<double, 3>, 4ul>&>(__gnu_cxx::__normal_iterator<Dune::UG::D3::linear_segment*, std::vector<Dune::UG::D3::linear_segment, std::allocator<Dune::UG::D3::linear_segment>>>, unsigned int&, int&&, int (&) [4], std::array<Dune::FieldVector<double, 3>, 4ul>&) /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/vector.tcc:453:33
#5 0x55a33a621841 in Dune::UG::D3::linear_segment& std::vector<Dune::UG::D3::linear_segment, std::allocator<Dune::UG::D3::linear_segment>>::emplace_back<unsigned int&, int, int (&) [4], std::array<Dune::FieldVector<double, 3>, 4ul>&>(unsigned int&, int&&, int (&) [4], std::array<Dune::FieldVector<double, 3>, 4ul>&) /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/vector.tcc:123:4
#6 0x55a33a621841 in Dune::GridFactory<Dune::UGGrid<3>>::createGrid() /home/sospinar/Codes/dune-sup-assembler/dune-modules/dune-grid/dune/grid/uggrid/uggridfactory.cc:401:30
#7 0x55a33a215a28 in std::unique_ptr<Dune::UGGrid<3>, std::default_delete<Dune::UGGrid<3>>> Dune::make3DHybridTestGrid<Dune::UGGrid<3>>() /home/sospinar/Codes/dune-sup-assembler/dune-modules/dune-grid/dune/grid/common/test/../../../../doc/grids/gridfactory/hybridtestgrids.hh:317:20
#8 0x55a33a212ab7 in main /home/sospinar/Codes/dune-sup-assembler/dune-modules/dune-grid/dune/grid/common/test/mcmgmappertest.cc:319:32
#9 0x7f0b25646249 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
Direct leak of 4816 byte(s) in 7 object(s) allocated from:
#0 0x55a33a1d336f in malloc (/home/sospinar/Codes/dune-sup-assembler/build-sospinar-optimized-clang18/dune-grid/dune/grid/common/test/RelWithDebInfo/mcmgmappertest+0xfe36f) (BuildId: cd9f61db62a9b8dde8a8f191f2baaa0031158854)
#1 0x7f0b25cacd31 in ompi_op_base_op_select (/lib/x86_64-linux-gnu/libmpi.so.40+0xdbd31) (BuildId: 2a2f4d8c4f8dc5dcc63f6789a50f3ab49f61e168)
Direct leak of 4816 byte(s) in 7 object(s) allocated from:
#0 0x55a33a1d336f in malloc (/home/sospinar/Codes/dune-sup-assembler/build-sospinar-optimized-clang18/dune-grid/dune/grid/common/test/RelWithDebInfo/mcmgmappertest+0xfe36f) (BuildId: cd9f61db62a9b8dde8a8f191f2baaa0031158854)
#1 0x7f0b223553a6 (<unknown module>)
Direct leak of 768 byte(s) in 1 object(s) allocated from:
#0 0x55a33a21063d in operator new(unsigned long) (/home/sospinar/Codes/dune-sup-assembler/build-sospinar-optimized-clang18/dune-grid/dune/grid/common/test/RelWithDebInfo/mcmgmappertest+0x13b63d) (BuildId: cd9f61db62a9b8dde8a8f191f2baaa0031158854)
#1 0x55a33a62a7d0 in std::__new_allocator<Dune::UG::D2::linear_segment>::allocate(unsigned long, void const*) /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/new_allocator.h:137:27
#2 0x55a33a62a7d0 in std::allocator_traits<std::allocator<Dune::UG::D2::linear_segment>>::allocate(std::allocator<Dune::UG::D2::linear_segment>&, unsigned long) /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/alloc_traits.h:464:20
#3 0x55a33a62a7d0 in std::_Vector_base<Dune::UG::D2::linear_segment, std::allocator<Dune::UG::D2::linear_segment>>::_M_allocate(unsigned long) /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/stl_vector.h:378:20
#4 0x55a33a62a7d0 in void std::vector<Dune::UG::D2::linear_segment, std::allocator<Dune::UG::D2::linear_segment>>::_M_realloc_insert<unsigned int&, int, int (&) [4], std::array<Dune::FieldVector<double, 2>, 2ul>&>(__gnu_cxx::__normal_iterator<Dune::UG::D2::linear_segment*, std::vector<Dune::UG::D2::linear_segment, std::allocator<Dune::UG::D2::linear_segment>>>, unsigned int&, int&&, int (&) [4], std::array<Dune::FieldVector<double, 2>, 2ul>&) /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/vector.tcc:453:33
#5 0x55a33a613a60 in Dune::UG::D2::linear_segment& std::vector<Dune::UG::D2::linear_segment, std::allocator<Dune::UG::D2::linear_segment>>::emplace_back<unsigned int&, int, int (&) [4], std::array<Dune::FieldVector<double, 2>, 2ul>&>(unsigned int&, int&&, int (&) [4], std::array<Dune::FieldVector<double, 2>, 2ul>&) /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/vector.tcc:123:4
#6 0x55a33a613a60 in Dune::GridFactory<Dune::UGGrid<2>>::createGrid() /home/sospinar/Codes/dune-sup-assembler/dune-modules/dune-grid/dune/grid/uggrid/uggridfactory.cc:401:30
#7 0x55a33a213766 in std::unique_ptr<Dune::UGGrid<2>, std::default_delete<Dune::UGGrid<2>>> Dune::make2DHybridTestGrid<Dune::UGGrid<2>>() /home/sospinar/Codes/dune-sup-assembler/dune-modules/dune-grid/dune/grid/common/test/../../../../doc/grids/gridfactory/hybridtestgrids.hh:88:20
#8 0x55a33a212a19 in main /home/sospinar/Codes/dune-sup-assembler/dune-modules/dune-grid/dune/grid/common/test/mcmgmappertest.cc:306:32
#9 0x7f0b25646249 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
...
SUMMARY: AddressSanitizer: 965727 byte(s) leaked in 15199 allocation(s).