giaf / blasfeo

Basic linear algebra subroutines for embedded optimization
Other
323 stars 88 forks source link

Examples memory leakage #78

Closed tsijs closed 6 years ago

tsijs commented 6 years ago

Sorry to bother you again, but the "getting_started" and "example_d_ricatti_recursion" have memory leaks according to valgrind.

giaf commented 6 years ago

I came across something similar on another test, my best guess is that this is due to the buggy implementation of the function posix_memalign http://pubs.opengroup.org/onlinepubs/007904975/functions/posix_memalign.html in linux, which seems to leak. On which system are you?

In BLASFEO, this routine is used in blasfeo_allocate_dmat and blasfeo_allocate_dvec.

tsijs commented 6 years ago

I am indeed using a Linux machine, but also when I replace all uses of posix_memalign with a malloc (I thought this should be possible, correct me if I'm wrong) and run it on embedded hardware, it still seems to leak. I haven't tried to do this on the Linux machine yet though.

giaf commented 6 years ago

Ok we actually found the issue, it is fixed now. https://github.com/giaf/blasfeo/commit/51c898f15f62e8f6fc284209bb0ca6d9672f10b6

Thanks for pointing it out!