Page 1 of 1

I found a memory leak, just reading Nyquist C sources

Posted: Fri Nov 22, 2013 11:15 pm
by Paul L
Is this the right board to report this? Call it a "code review."

Try this in the Nyquist prompt, no matter how small the selection, and watch memory usage of the Audacity process:

Code: Select all

(dotimes (i 10000000)
(snd-maxsamp s))
Untried fix: at line 106 of samples.c, change

Code: Select all

    return (double) (s->scale * result);
to

Code: Select all

    { double the_result = (s->scale * result); sound-unref(s); return the_result; }
(This on just my first day of digging into the sources. Time to install an actual compiler and debugger, I suppose.)

Re: I found a memory leak, just reading Nyquist C sources

Posted: Fri Nov 22, 2013 11:54 pm
by Paul L
Perhaps you could just unref before returning the value, without a new variable... I must be thinking in terms of Lisp or of concurrent programming.