GSL Levenberg-Marquardt memory usage

I have a large 2D histogram (around 2000x2000 pixels) to which I attempt to fit a function (like a gaussian or paraboloid). It seems that Levenberg-Marquadt takes about 2.5 times more memory for the fitting procedure than Minuit. Even more, it does not seem to free it after the fit, although I am not sure about that, for I was running out of mem and it could be some kind of a temporary effect. Is such a difference in memory usage between LM and Minuit fitting methods a normal thing?

Hi,
it is true the GSL Levenberg-Marquardt takes more memory than Minuit, because it needs to store in addition to the vector of the function values also the matrix (ndata x nparameters) of the derivative values for each data point. This is required by the GSL interface and I cannot change.
If you use Fumili or Fumili2, which are similar algorithms, the derivative values are not stored but computed every time, so it should almost the same memory as in Minuit.
I will check eventually if the memory is freed after the fit or if there is a memory leak,
Cheers,
Lorenzo

[quote=“moneta”]Hi,
it is true the GSL Levenberg-Marquardt takes more memory than Minuit, because it needs to store in addition to the vector of the function values also the matrix (ndata x nparameters) of the derivative values for each data point. This is required by the GSL interface and I cannot change.
[/quote]

That’s what I suspected… Thanks for confirming.

True, I had no such problems with Fumili. The point is, that LM is much much faster when one is close to a minimum :slight_smile: I’ll also try to check if there is truely a memory leak.