foamToEnsight leaks memory
Summary
valgrind reports some in-use memory after finishing. E.g. foamToVTK does not.
Steps to reproduce
valgrind --leak-check=full foamToEnsight
==3683== HEAP SUMMARY:
==3683== in use at exit: 171 bytes in 4 blocks
==3683== total heap usage: 67,611 allocs, 67,607 frees, 6,829,195 bytes allocated
==3683==
==3683== 143 (72 direct, 71 indirect) bytes in 1 blocks are definitely lost in loss record 4 of 4
==3683== at 0x4C2A6F0: operator new(unsigned long) (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==3683== by 0x6921081: Foam::IOobjectList::IOobjectList(Foam::objectRegistry const&, Foam::fileName const&, Foam::fileName const&, Foam::IOobject::readOption, Foam::IOobject::writeOption, bool) (in /home/preston2/mattijs/OpenFOAM/work/develop/OpenFOAM-plus/platforms/linux64GccDPInt32Opt/lib/libOpenFOAM.so)
==3683== by 0x44F58C: main (in /home/preston2/mattijs/OpenFOAM/work/develop/OpenFOAM-plus/platforms/linux64GccDPInt32Opt/bin/foamToEnsight)
Environment information
OpenFOAM version : develop
No child items are currently assigned. Use child items to break down this issue into smaller parts.
Link issues together to show that they're related. Learn more.
Activity
- Mattijs Janssens added bug label
added bug label
- Maintainer
Any particular case to try or serial/parallel? With something really basic/laplacianFoam/flange/
==4534== HEAP SUMMARY: ==4534== in use at exit: 0 bytes in 0 blocks ==4534== total heap usage: 144,485 allocs, 144,485 frees, 9,289,937 bytes allocated ==4534== ==4534== All heap blocks were freed -- no leaks are possible
- Author Maintainer
heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges
valgrind --leak-check=full foamToEnsight
reports:==27257== ==27257== HEAP SUMMARY: ==27257== in use at exit: 170 bytes in 4 blocks ==27257== total heap usage: 257,746 allocs, 257,742 frees, 24,015,742 bytes allocated ==27257== ==27257== 143 (72 direct, 71 indirect) bytes in 1 blocks are definitely lost in loss record 4 of 4 ==27257== at 0x4C2A6F0: operator new(unsigned long) (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==27257== by 0x8DADD8A: Foam::IOobjectList::IOobjectList(Foam::objectRegistry const&, Foam::fileName const&, Foam::fileName const&, Foam::IOobject::readOption, Foam::IOobject::writeOption, bool) (in /home/preston2/mattijs/OpenFOAM/work/develop/OpenFOAM-plus/platforms/linux64GccDPInt32Opt/lib/libOpenFOAM.so) ==27257== by 0x44F4BA: main (in /home/preston2/mattijs/OpenFOAM/work/develop/OpenFOAM-plus/platforms/linux64GccDPInt32Opt/bin/foamToEnsight) ==27257== ==27257== LEAK SUMMARY: ==27257== definitely lost: 72 bytes in 1 blocks =
- Maintainer
gravity again?
- Author Maintainer
/*---------------------------------------------------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: plus | | \\ / A nd | Web: www.OpenFOAM.com | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ Build : dcbbaf0bdf-20190429 OPENFOAM=1904 Arch : "LSB;label=32;scalar=64" Exec : foamToEnsight Date : May 01 2019 Time : 14:50:23 Host : preston PID : 29937 I/O : uncollated Case : /home/preston2/mattijs/OpenFOAM/work/develop/OpenFOAM-plus/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges nProcs : 1 trapFpe: Floating point exception trapping enabled (FOAM_SIGFPE). fileModificationChecking : Monitoring run-time modified files using timeStampMaster (fileModificationSkew 10) allowSystemOperations : Allowing user-supplied system call operations // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Initial memory 408676 kB Create time Overriding DebugSwitches according to controlDict regIOobject 2; Create mesh for time = 0 Converting 2 time steps Ensight case: path: "/home/preston2/mattijs/OpenFOAM/work/develop/OpenFOAM-plus/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/EnSight" name: iglooWithFridges.case format: binary values per element Search for moving mesh ... none detected. Searching for lagrangian ... none detected. Startup in 4.91 s, 436796 kB Time [0] = 0 Write volume field ( T alphat epsilon k nut p p_rgh U ) Wrote in 1.83 s, 452044 kB Time [1] = 45 Write volume field ( T alphat epsilon k nut p p_rgh U ) Wrote in 3.91 s, 457212 kB End: 10.66 s, 457244 kB (peak) ==29937== ==29937== HEAP SUMMARY: ==29937== in use at exit: 170 bytes in 4 blocks ==29937== total heap usage: 257,746 allocs, 257,742 frees, 24,015,742 bytes allocated ==29937== ==29937== 27 bytes in 1 blocks are still reachable in loss record 1 of 4 ==29937== at 0x4C2A6F0: operator new(unsigned long) (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==29937== by 0x97D1918: std::string::_Rep::_S_create(unsigned long, unsigned long, std::allocator<char> const&) (in /usr/lib64/libstdc++.so.6.0.25) ==29937== by 0x97D278A: std::string::_Rep::_M_clone(std::allocator<char> const&, unsigned long) (in /usr/lib64/libstdc++.so.6.0.25) ==29937== by 0x97D2EF3: std::string::assign(std::string const&) (in /usr/lib64/libstdc++.so.6.0.25) ==29937== by 0x90B6D6E: Foam::readDir(Foam::fileName const&, Foam::fileName::Type, bool, bool) (in /home/preston2/mattijs/OpenFOAM/work/develop/OpenFOAM-plus/platforms/linux64GccDPInt32Opt/lib/libOpenFOAM.so) ==29937== by 0x8C8F1FB: Foam::fileOperation::findTimes(Foam::fileName const&, Foam::word const&) const (in /home/preston2/mattijs/OpenFOAM/work/develop/OpenFOAM-plus/platforms/linux64GccDPInt32Opt/lib/libOpenFOAM.so) ==29937== by 0x8DDEF77: Foam::TimePaths::findTimes(Foam::fileName const&, Foam::word const&) (in /home/preston2/mattijs/OpenFOAM/work/develop/OpenFOAM-plus/platforms/linux64GccDPInt32Opt/lib/libOpenFOAM.so) ==29937== by 0x8DDEFB1: Foam::TimePaths::times() const (in /home/preston2/mattijs/OpenFOAM/work/develop/OpenFOAM-plus/platforms/linux64GccDPInt32Opt/lib/libOpenFOAM.so) ==29937== by 0x8DF5B21: Foam::timeSelector::select0(Foam::Time&, Foam::argList const&) (in /home/preston2/mattijs/OpenFOAM/work/develop/OpenFOAM-plus/platforms/linux64GccDPInt32Opt/lib/libOpenFOAM.so) ==29937== by 0x44DA67: main (in /home/preston2/mattijs/OpenFOAM/work/develop/OpenFOAM-plus/platforms/linux64GccDPInt32Opt/bin/foamToEnsight) ==29937== ==29937== 28 bytes in 1 blocks are indirectly lost in loss record 2 of 4 ==29937== at 0x4C2A6F0: operator new(unsigned long) (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==29937== by 0x97D1918: std::string::_Rep::_S_create(unsigned long, unsigned long, std::allocator<char> const&) (in /usr/lib64/libstdc++.so.6.0.25) ==29937== by 0x97D278A: std::string::_Rep::_M_clone(std::allocator<char> const&, unsigned long) (in /usr/lib64/libstdc++.so.6.0.25) ==29937== by 0x97D2EF3: std::string::assign(std::string const&) (in /usr/lib64/libstdc++.so.6.0.25) ==29937== by 0x90B6D6E: Foam::readDir(Foam::fileName const&, Foam::fileName::Type, bool, bool) (in /home/preston2/mattijs/OpenFOAM/work/develop/OpenFOAM-plus/platforms/linux64GccDPInt32Opt/lib/libOpenFOAM.so) ==29937== by 0x8C8C902: Foam::fileOperation::readObjects(Foam::objectRegistry const&, Foam::fileName const&, Foam::fileName const&, Foam::word&) const (in /home/preston2/mattijs/OpenFOAM/work/develop/OpenFOAM-plus/platforms/linux64GccDPInt32Opt/lib/libOpenFOAM.so) ==29937== by 0x8C987F9: Foam::fileOperations::uncollatedFileOperation::readObjects(Foam::objectRegistry const&, Foam::fileName const&, Foam::fileName const&, Foam::word&) const (in /home/preston2/mattijs/OpenFOAM/work/develop/OpenFOAM-plus/platforms/linux64GccDPInt32Opt/lib/libOpenFOAM.so) ==29937== by 0x8DADCEE: Foam::IOobjectList::IOobjectList(Foam::objectRegistry const&, Foam::fileName const&, Foam::fileName const&, Foam::IOobject::readOption, Foam::IOobject::writeOption, bool) (in /home/preston2/mattijs/OpenFOAM/work/develop/OpenFOAM-plus/platforms/linux64GccDPInt32Opt/lib/libOpenFOAM.so) ==29937== by 0x44F4BA: main (in /home/preston2/mattijs/OpenFOAM/work/develop/OpenFOAM-plus/platforms/linux64GccDPInt32Opt/bin/foamToEnsight) ==29937== ==29937== 43 bytes in 1 blocks are indirectly lost in loss record 3 of 4 ==29937== at 0x4C2A6F0: operator new(unsigned long) (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==29937== by 0x97D1918: std::string::_Rep::_S_create(unsigned long, unsigned long, std::allocator<char> const&) (in /usr/lib64/libstdc++.so.6.0.25) ==29937== by 0x97D1C91: std::string::_M_mutate(unsigned long, unsigned long, unsigned long) (in /usr/lib64/libstdc++.so.6.0.25) ==29937== by 0x97D22ED: std::string::_M_replace_safe(unsigned long, unsigned long, char const*, unsigned long) (in /usr/lib64/libstdc++.so.6.0.25) ==29937== by 0x8D5762C: Foam::ISstream::read(Foam::word&) (in /home/preston2/mattijs/OpenFOAM/work/develop/OpenFOAM-plus/platforms/linux64GccDPInt32Opt/lib/libOpenFOAM.so) ==29937== by 0x8D57FAD: Foam::ISstream::readWordToken(Foam::token&) (in /home/preston2/mattijs/OpenFOAM/work/develop/OpenFOAM-plus/platforms/linux64GccDPInt32Opt/lib/libOpenFOAM.so) ==29937== by 0x8D58F6A: Foam::ISstream::read(Foam::token&) (in /home/preston2/mattijs/OpenFOAM/work/develop/OpenFOAM-plus/platforms/linux64GccDPInt32Opt/lib/libOpenFOAM.so) ==29937== by 0x8D528E9: Foam::token::token(Foam::Istream&) (in /home/preston2/mattijs/OpenFOAM/work/develop/OpenFOAM-plus/platforms/linux64GccDPInt32Opt/lib/libOpenFOAM.so) ==29937== by 0x8D7E08C: Foam::entry::New(Foam::dictionary&, Foam::Istream&, Foam::entry::inputMode, int) (in /home/preston2/mattijs/OpenFOAM/work/develop/OpenFOAM-plus/platforms/linux64GccDPInt32Opt/lib/libOpenFOAM.so) ==29937== by 0x8D765B2: Foam::dictionary::read(Foam::Istream&, bool) (in /home/preston2/mattijs/OpenFOAM/work/develop/OpenFOAM-plus/platforms/linux64GccDPInt32Opt/lib/libOpenFOAM.so) ==29937== by 0x8D77836: Foam::dictionary::dictionary(Foam::Istream&, bool) (in /home/preston2/mattijs/OpenFOAM/work/develop/OpenFOAM-plus/platforms/linux64GccDPInt32Opt/lib/libOpenFOAM.so) ==29937== by 0x8DA8F99: Foam::IOobject::readHeader(Foam::Istream&) (in /home/preston2/mattijs/OpenFOAM/work/develop/OpenFOAM-plus/platforms/linux64GccDPInt32Opt/lib/libOpenFOAM.so) ==29937== ==29937== 143 (72 direct, 71 indirect) bytes in 1 blocks are definitely lost in loss record 4 of 4 ==29937== at 0x4C2A6F0: operator new(unsigned long) (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==29937== by 0x8DADD8A: Foam::IOobjectList::IOobjectList(Foam::objectRegistry const&, Foam::fileName const&, Foam::fileName const&, Foam::IOobject::readOption, Foam::IOobject::writeOption, bool) (in /home/preston2/mattijs/OpenFOAM/work/develop/OpenFOAM-plus/platforms/linux64GccDPInt32Opt/lib/libOpenFOAM.so) ==29937== by 0x44F4BA: main (in /home/preston2/mattijs/OpenFOAM/work/develop/OpenFOAM-plus/platforms/linux64GccDPInt32Opt/bin/foamToEnsight) ==29937== ==29937== LEAK SUMMARY: ==29937== definitely lost: 72 bytes in 1 blocks ==29937== indirectly lost: 71 bytes in 2 blocks ==29937== possibly lost: 0 bytes in 0 blocks ==29937== still reachable: 27 bytes in 1 blocks ==29937== of which reachable via heuristic: ==29937== stdstring : 27 bytes in 1 blocks ==29937== suppressed: 0 bytes in 0 blocks ==29937== ==29937== For counts of detected and suppressed errors, rerun with: -v ==29937== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
- Mark OLESEN assigned to @mark
assigned to @mark
- Maintainer
Problem traced back to IOobjectList::filterObjects(), which is backed by a
filterKeys()
. This drops through to the HashTable instead of the HashPtrTable, which means that erasing the iterator does not free up memory since it erases from HashTable instead of HashPtrTable!Short-term fix could be to include the code for filterKeys() in HashPtrTable or transfer it to IOobjectLists. The longer-term fix would mean changing the inheritance of HashPtrTable from 'HashTable<T*>
to
HashTable<autoPtr>or
HashTable<unique_ptr>` to remove memory management from HashPtrTable. - Mark OLESEN mentioned in commit f4a5d2763881d2db4d4a49baf4955489ed91b253
mentioned in commit f4a5d2763881d2db4d4a49baf4955489ed91b253
- Mark OLESEN mentioned in commit 684af1cd5b05b1a6c5010730b700f30fa601c5ac
mentioned in commit 684af1cd5b05b1a6c5010730b700f30fa601c5ac
- Mark OLESEN mentioned in merge request !256 (closed)
mentioned in merge request !256 (closed)
- Mark OLESEN mentioned in commit c49c47a8128f287f606427aa9a34c2e6b0e893ef
mentioned in commit c49c47a8128f287f606427aa9a34c2e6b0e893ef
- Mark OLESEN mentioned in commit 79d915ec61d6a529a8a8d799c63819f5014a5c15
mentioned in commit 79d915ec61d6a529a8a8d799c63819f5014a5c15
- Mark OLESEN mentioned in commit 7a906b7dd7e71355daee8f68efd436598e6c633e
mentioned in commit 7a906b7dd7e71355daee8f68efd436598e6c633e
- Mark OLESEN mentioned in commit 1910c508396ec517bd6c476cd0128593d8b85c25
mentioned in commit 1910c508396ec517bd6c476cd0128593d8b85c25
- Mark OLESEN mentioned in commit 6d0c3c4725a40090c9f20839aa4b4e3e0cf47028
mentioned in commit 6d0c3c4725a40090c9f20839aa4b4e3e0cf47028
- Mark OLESEN mentioned in commit 9d8899ca07fe905abb2859b3fde8a3869b2c70e9
mentioned in commit 9d8899ca07fe905abb2859b3fde8a3869b2c70e9
- Mark OLESEN mentioned in commit eca8ff006fd83e4f7bfde4ae1913a3309cd4b170
mentioned in commit eca8ff006fd83e4f7bfde4ae1913a3309cd4b170
- Mark OLESEN closed
closed
- Mark OLESEN mentioned in commit f21144acdb7b85bd551d36c0ecdb4a88c589e774
mentioned in commit f21144acdb7b85bd551d36c0ecdb4a88c589e774
- Mark OLESEN mentioned in commit ac699b3f
mentioned in commit ac699b3f
- Mark OLESEN mentioned in commit 65d640e5
mentioned in commit 65d640e5