I found a memory leak, just reading Nyquist C sources

Using Nyquist scripts in Audacity.
Post and download new plug-ins.
Forum rules
If you require help using Audacity, please post on the forum board relevant to your operating system:
Windows
Mac OS X
GNU/Linux and Unix-like
Post Reply
Paul L
Posts: 1782
Joined: Mon Mar 11, 2013 7:37 pm
Operating System: Please select

I found a memory leak, just reading Nyquist C sources

Post by Paul L » Fri Nov 22, 2013 11:15 pm

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.)
Last edited by Paul L on Sat Nov 23, 2013 4:45 am, edited 1 time in total.

Paul L
Posts: 1782
Joined: Mon Mar 11, 2013 7:37 pm
Operating System: Please select

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

Post by Paul L » Fri Nov 22, 2013 11:54 pm

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.

Post Reply