Memory leaks in Nyquist or the Lisp environment?

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
Paul L
Posts: 1782
Joined: Mon Mar 11, 2013 7:37 pm
Operating System: Please select

Re: Memory leaks in Nyquist or the Lisp environment?

Post by Paul L » Wed Oct 09, 2013 3:43 pm

Perhaps a different pronlem. You add many one samples sounds but they have the same time extent, not disjoint.

steve
Site Admin
Posts: 80679
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Memory leaks in Nyquist or the Lisp environment?

Post by steve » Wed Oct 30, 2013 6:23 am

Hi Paul. Did you get any further isolating this memory leak or working round it?
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

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

Re: Memory leaks in Nyquist or the Lisp environment?

Post by Paul L » Thu Oct 31, 2013 2:00 am

I found ways to work around it. Roger agreed there was a bug to fix there, in case of adding of sounds with domains that touch without overlapping, but I haven't heard more from him.

Now I concatenate a sequence of sounds by using snd-fromobject and an object that calls snd-fetch repeatedly on each. Sounds like doing more work in Lisp than I should, but it works.

But I am not using this technique on my current project of interest, that de-clicker which shows a lot of promise without relying on my other speech segmentation experiments.

steve
Site Admin
Posts: 80679
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Memory leaks in Nyquist or the Lisp environment?

Post by steve » Thu Oct 31, 2013 3:27 am

Does this demonstrate the same problem that you had:

Code: Select all

;; Generate 10 minutes of silence
;; Memory usage goes up and stays up after completion.
(let ((mysound (abs-env (s-rest 0.1)))
      (output (s-rest 0)))
  (dotimes (i 6000 output)
    (setf output
      (sim output
        (at-abs (* 0.1 i) (cue mysound))))))
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

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

Re: Memory leaks in Nyquist or the Lisp environment?

Post by Paul L » Thu Oct 31, 2013 5:45 am

I take your word that you observed great memory usage. Yes, it seems a similar problem.

I was also using tiny "sounds" of one sample only as summands, which may or may not be essential to the problem. Perhaps not, if this demonstrates the same problem.

steve
Site Admin
Posts: 80679
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Memory leaks in Nyquist or the Lisp environment?

Post by steve » Thu Oct 31, 2013 2:38 pm

Paul L wrote:I take your word that you observed great memory usage.
Memory usage with that code is not massive, but much bigger than it should be, and importantly it is not released when the code completes.

A simple workaround for this example is to add an initial silence starting at t0, with a duration equal or greater than the expected output. All subsequent additions will then overlap this "dummy" silence in the time domain and the memory leak does not occur.

I'd like to get this bug on the Audacity bug tracking system so that it is tracked and not forgotten about. Is there anything that you'd like to add or clarify before I do?
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

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

Re: Memory leaks in Nyquist or the Lisp environment?

Post by Paul L » Thu Oct 31, 2013 4:38 pm

I think we have described the essentials of the problem. I have nothing to add.

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

Re: Memory leaks in Nyquist or the Lisp environment?

Post by Paul L » Wed Dec 04, 2013 6:01 am

I had a hypothesis about the cause of this memory leak, but it's not correct. I never hit the relevant code in the debugger with your example.

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

Re: Memory leaks in Nyquist or the Lisp environment?

Post by Paul L » Wed Dec 04, 2013 6:05 am

steve wrote:Thanks for the update Paul.

Probably related, I found that the following code causes a crash:

Code: Select all

(do ((i 0 (1+ i)))
    ((= i  100000) s)
  (setf s (sum s (snd-const 0 0 *sound-srate* 1))))
That's a stack overflow. Different problem.

Post Reply