More than one year ago here was commit that caused memory leaks:
For example, if you use Math::GSL::Fit, it will cause a memory leak.
So I have tried to revert this change. Only QRNG.t test have failed because gsl_qrng_get() returns array of doubles.
With a little changes QRNG works correctly.
I have this commit: tadam/math--gsl@a4ac822
All tests successful.
But maybe here some another reasons for initial commit with commented free()?
I originally commented that code out because I was seeing segfaults in CPANTester reports. I like your solution better. The trade-off is that we are forcing people to wait until DESTROY-time to free these objects, which I don't think is too unreasonable. Can you think of a simple way to check if gsl_qrng_free has been called already?
In any case, if you want to make a pull request, I will merge this.
Plug a memory leak in QRNG, fixes #31 and fixes #32. Also disable som…
…e Randist tests
Hmm, I already have made similar behavior for Math::GSL::Min and Math::GSL::Roots.
In these modules we can't call *_free() and then make DESTROY too.
Anyway, if we call gsl_qrng_free(obj) we can't use this obj anymore. And if somebody already have the code that calls gsl_qrng_free(), it makes no much sense, because the code that uses Math::GSL without freeing double, will leak in any case. But if we don't want to break such code we can try to support more intelligent DESTROY. What is your opinion about this?
If somebody wants to force freeing object, he can write undef $qrng;. Furthermore, I believe that in the future we should remove *_free() functions from export (IMHO).
I understand better now. And yes, I was confusing DESTROY time and END time. If you submit a pull request to not export *_free functions, I will merge it.