bug-gsl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-gsl] Re: GSL Nonlinear Least-Squares Fitting - Memory Leak


From: Wylie Chan
Subject: [Bug-gsl] Re: GSL Nonlinear Least-Squares Fitting - Memory Leak
Date: Wed, 3 Aug 2005 15:43:05 -0400

Missing info from first email:

The version number of GSL = 1.6 (for Windows)
The hardware = Intel Pentium 4
Operating system = Win 2000 SP 4

Compiler used = MS VS .NET C++ environment
        including version number = not sure
        and compilation options = Compiled in Debug Mode

Thanks.




   Wylie Chan/HQ/FHLMC 
   08/03/2005 02:22 PM

To
address@hidden
cc

Subject
GSL Nonlinear Least-Squares Fitting - Memory Leak





Dear GSL Administrator,

I refer to the example code in the GSL reference manual online,
under the section "Nonlinear Least-Squares Fitting" at
http://www.gnu.org/software/gsl/manual/gsl-ref_37.html#SEC476

I tried to replace the 11th line of code in the main method
by replacing the double array with initializer list
with a double pointer to an array initialized using "new", and using 
"delete [ ]" afterwards.

-------------------------------------------------------------------

int
main (void)
{
        ...
        ...
        ...
 

        // Original approach:
        // double x_init[3] = { 1.0, 0.0, 0.0 };

        // My approach: try allocating on heap instead 
        // --> runs fine, but fails in purify (memory leak)
        double * x_init = new double[ 3 ]; 
        x_init[0] = 1.0; 
        x_init[1] = 0.0; 
        x_init[2] = 0.0; 
 
        gsl_vector_view x = gsl_vector_view_array (x_init, p);

        ...
        ...
        ...

        delete [] x_init; 

        return 0;
}

-------------------------------------------------------------------

The result was that the example still ran fine normally,
but in "Purify", memory leaks are detected when in the original example,
no memory leaks were found.

Please advise.

Thank you.


Sincerely,

Wylie Chan

Fixed Income Research
Freddie Mac
1551 Park Run Dr.,
McLean, VA 22102



reply via email to

[Prev in Thread] Current Thread [Next in Thread]