Direct and indirect memory leaks
agarny opened this issue · comments
Hi @fbergmann,
I have a very simple piece of code to check whether a file is a COMBINE archive:
bool isCombineArchive(const std::string &pFileName)
{
// Try to retrieve a COMBINE archive.
auto combineArchive = libcombine::CombineArchive();
auto res = combineArchive.initializeFromArchive(pFileName);
if (res) {
combineArchive.cleanUp();
}
return res;
}
It works as expected, but... it leaks memory. Here is a summary of the different traces that I am getting:
operator new(unsigned long)
zipper::Unzipper::Unzipper(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) (unzipper.cpp:488)
libcombine::CombineArchive::initializeFromArchive(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool) (combinearchive.cpp:62)
operator new(unsigned long)
zipper::Unzipper::Unzipper(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) (unzipper.cpp:492)
libcombine::CombineArchive::initializeFromArchive(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool) (combinearchive.cpp:62)
operator new(unsigned long)
zipper::Unzipper::Unzipper(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) (unzipper.cpp:487)
libcombine::CombineArchive::initializeFromArchive(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool) (combinearchive.cpp:62)
operator new(unsigned long)
libcombine::CaListOfContents::createObject(libsbml::XMLInputStream&) (CaListOfContents.cpp:309)
libcombine::CaOmexManifest::createObject(libsbml::XMLInputStream&) (CaOmexManifest.cpp:477)
libcombine::CaBase::read(libsbml::XMLInputStream&) (CaBase.cpp:2242)
libcombine::CaReader::readInternal(char const*, bool) (CaReader.cpp:228)
libcombine::CaReader::readOMEXFromString(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) (CaReader.cpp:135)
readOMEXFromString (CaReader.cpp:376)
libcombine::CombineArchive::initializeFromArchive(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool) (combinearchive.cpp:89)
As you can tell, the last trace refers to a memory leak in libCombine
itself while the others to memory leaks in zipper
. I checked the official zipper
and it looks like the memory leaks have been fixed. So, it ought to be as simple as upgrading your version of zipper
? (I wanted to create an issue at https://github.com/fbergmann/zipper, but I can't...?!)
I am just getting started with libCombine
and I am going to ignore whatever memory leaks it generates. Still, it would be nice to have them fixed, if possible.
Cheers, Alan.
i've created a new release that should have resolved the issue. thanks for letting me know
Thanks @fbergmann, I can confirm that the memory leaks are now gone. Feel free to close this issue.
thank you again