On 07/19/2016 05:27 AM, John W. Eaton wrote:
On 07/19/2016 02:42 AM, Susi Lehtola wrote:
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.
Right, just as I thought.
I tried running octave through valgrind, but I don't get any output..
What options did you use for valgrind?
$ valgrind --leak-check=full octave --eval "pkg load
gsl;A=legendre_sphPlm_array(10,10,0.0);"
==6971== Memcheck, a memory error detector
==6971== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==6971== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright info
==6971== Command: octave --eval pkg\ load\
gsl;A=legendre_sphPlm_array(10,10,0.0);
==6971==
octave: X11 DISPLAY environment variable not set
octave: disabling GUI features
Without the semicolon you see the array, but again the usual valgrind
output is missing..?