|
From: | John W. Eaton |
Subject: | Re: Is this a memory leak? |
Date: | Tue, 19 Jul 2016 08:27:00 -0400 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Icedove/38.5.0 |
On 07/19/2016 02:42 AM, Susi Lehtola wrote:
Some code in octave-gsl: RowVector *y = new RowVector(gsl_sf_legendre_array_n (lmax)); double *yd = y->fortran_vec(); gsl_sf_legendre_array (GSL_SF_LEGENDRE_SPHARM, lmax, x, yd); return octave_value_list(octave_value(*y)); Is this a memory leak, since y is dynamically allocated but it's given as a dereferenced pointer to octave_value?
Yes, it is a leak. You don't need to create the RowVector object with new. The memory for RowVector, octave_value, and nearly all other objects in Octave is managed by reference counting.
I tried running octave through valgrind, but I don't get any output..
What options did you use for valgrind? jwe
[Prev in Thread] | Current Thread | [Next in Thread] |