New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Fix] Remaining memory leaks in tests #5494
[Fix] Remaining memory leaks in tests #5494
Conversation
What does this do in case of actual deletion during assignment? Does not look right but I only gave it a quick thought.
|
In the TSG_test, is add_metainfo_ enabled? The move here looks suspicious, especially for a class that inherits from both std::vector and MetaInfoDescription with a default move ctor.
I am also not sure if it is safe (or catchable by ASAN), if a moved_from pointer is deleted. Maybe make it a nullptr after the move? |
While I think you are correct with the rest of the leaks to be related to third-party libraries, I also think that probably some of them could be due to misuse of those libraries and could still be solved on our end. Thanks for investigating. |
OpenMS/src/openms/source/METADATA/PeptideHit.cpp Lines 129 to 135 in bf46a11
Yes, it does look a bit weird.
Form some tests it is activated for others it is not. OpenMS/src/tests/class_tests/openms/source/TheoreticalSpectrumGenerator_test.cpp Lines 224 to 227 in 34f271d
OpenMS/src/tests/class_tests/openms/source/TheoreticalSpectrumGenerator_test.cpp Lines 251 to 254 in 34f271d
I'll do that.
I figured that too. Fixing some of these memory leaks would require some major refactoring. That's probably not worth it considering only some bytes are leaking. |
Yep, give those a try. Do you have an ASAN setup on your hardware? |
Regarding OpenMS/src/tests/class_tests/openms/source/TheoreticalSpectrumGenerator_test.cpp Line 598 in 34f271d
OpenMS/src/tests/class_tests/openms/source/TheoreticalSpectrumGenerator_test.cpp Line 604 in 34f271d
So I concluded that getSpectrum is generally safe except for a premature function exit like an exception. If an exception occurs the delete statement might not be reached and the memory is not freed. The only way I know how to prevent that is to use smart pointers because they'll clean up after you in any case. In this case std::shared_ptr because ion_names and charges need to have shared access since they can be passed to more than one function like addPeaks_ , addPrecursorPeaks_ , ....As always std::shared_ptr introduces some overhead but I think it should be negligible in this case. What do you think?
Fixing the |
Yep, here safety would be more important than speed to me. I think the operations on the vectors will be more expensive than handling the pointers anyway. |
Description
I had a look at the remaining memory leaks in the tests. Sadly almost all have them are due to leaks in third party dependencies and therefore hardly fixable.
std::shared_ptr
. Not sure if this introduces a relevant performance penalty. Thoughts?xercesc_3_2::MemoryManagerImpl::allocate(unsigned long)
xercesc_3_2::MemoryManagerImpl::allocate(unsigned long)
, ...FeatureFinderAlgorithmPicked
FeatureFinderAlgorithmPicked_test
xercesc_3_2::DefaultHandler
Checklist:
How can I get additional information on failed tests during CI:
If your PR is failing you can check out
Note: