Closed jml70 closed 3 months ago
Great catch! Can you make the changes into a pull request?
Ok, I made the change, but I've only recompiled the mac intel version. If anyone wants to contribute compiled versions for windows, linux and Apple silicon, I'd gladly incorporate those and make a new release
There is a memory leak in lbfgsb_wrapper.c which results in memory allocated within the call to the objective function and its gradient not being freed. As a result, the solver allocates an additional chunk of memory (equal to the size of the gradient) every iteration.
The fix is fairly simple, move the calls to mxDestroyArray( LHS[...] ) on lines 324-325 inside the loop to line 313.