Skip to content
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

Memory Leak #6

Open
jkuck opened this issue Jun 2, 2022 · 3 comments
Open

Memory Leak #6

jkuck opened this issue Jun 2, 2022 · 3 comments

Comments

@jkuck
Copy link
Contributor

jkuck commented Jun 2, 2022

Hi Alan, I'm making a call to pareto::front.hypervolume() and found that this call leaks memory. When running through valgrind, this is the error that I'm getting:

==77189== Mismatched free() / delete / delete []
==77189==    at 0x4C32D3B: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==77189==    by 0x1A6082: pareto::fpli_hv(double*, int, int, double const*) (hypervolume.h:820)
==77189==    by 0x1ACCDA: pareto::front<long, 3ul, unsigned int, pareto::r_tree<long, 3ul, unsigned int, std::less<long>, std::allocator<std::pair<pareto::point<long, 3ul, void> const, unsigned int> > > >::hypervolume(pareto::point<long, 3ul, void>) const (front.h:930)

And the final valgrind ouput looks like this:

==77189== 
==77189== HEAP SUMMARY:
==77189==     in use at exit: 391,049 bytes in 4,115 blocks
==77189==   total heap usage: 1,901,304 allocs, 1,897,189 frees, 471,587,726 bytes allocated
==77189== 
==77189== LEAK SUMMARY:
==77189==    definitely lost: 8,008 bytes in 32 blocks
==77189==    indirectly lost: 265,176 bytes in 2,133 blocks
==77189==      possibly lost: 0 bytes in 0 blocks
==77189==    still reachable: 117,865 bytes in 1,950 blocks
==77189==         suppressed: 0 bytes in 0 blocks
==77189== Rerun with --leak-check=full to see details of leaked memory
==77189== 
==77189== For counts of detected and suppressed errors, rerun with: -v
==77189== ERROR SUMMARY: 32487 errors from 7 contexts (suppressed: 0 from 0)

Do you have any ideas for fixing this problem? Thanks!

@jkuck
Copy link
Contributor Author

jkuck commented Jun 3, 2022

I've submitted a pull request to fix this problem here: #7

@alandefreitas
Copy link
Owner

Oh! I missed that free() when refactoring the code.

Since I'm pretty sure the original algorithm in http://lopez-ibanez.eu/hypervolume in not actively maintained, I should probably just refactor the whole thing to real C++ at some point.

@jkuck
Copy link
Contributor Author

jkuck commented Jun 4, 2022

No worries, I really appreciate all the functionality that you've built :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants