Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
valgrind inspired fixes #1693
Some valgrind output added into this pull requests will help. I also think we might be able to get some better or at least different results profiling than with the gprof.
A wiki on how you are doing this will be very helpful IMHO.
fix referencing local stack variable in async thread
Valgrind reported both invalid reads and invalid writes with traces like this:
The original code created a local variable on stack and deferred a lambda function reference-capturing the local variable into an asynchronous thread. At the time the lambda function was called, it used already invalidated memory. What is worse, it could rewrite a stack in use.
I have put the object into a shared_ptr and capture it in the lambda function by copy. After the last commit I have tested it again and compared the logs from valgrind. Definitely fixed.
explicitly cleanup external library facilities
Various memory leaks are detected with malloc being called from
The proposed proper cleanup shrinks the number of the reported memory leaks, yet some of them remain.
I think is possible, Added.