Re: [R] How to clear R memory in a for loop

2014-10-22 Thread Dimitri Liakhovitski
Thank you very much for looking into it, gentlemen! On Tue, Oct 21, 2014 at 2:29 PM, Uwe Ligges wrote: > > > On 21.10.2014 19:00, William Dunlap wrote: >> >> A few minutes with valgrind showed that output_pos was never >> initialized, so the output array was not getting filled correctly. >> The f

Re: [R] How to clear R memory in a for loop

2014-10-21 Thread Uwe Ligges
On 21.10.2014 19:00, William Dunlap wrote: A few minutes with valgrind showed that output_pos was never initialized, so the output array was not getting filled correctly. The following fixes that problem diff -ru tuneR/src/readmp3.c /homes/bill/packages/tuneR/src/readmp3.c --- tuneR/src/readmp

Re: [R] How to clear R memory in a for loop

2014-10-21 Thread William Dunlap
A few minutes with valgrind showed that output_pos was never initialized, so the output array was not getting filled correctly. The following fixes that problem diff -ru tuneR/src/readmp3.c /homes/bill/packages/tuneR/src/readmp3.c --- tuneR/src/readmp3.c 2014-04-07 04:38:21.0 -0700 +++ /ho

Re: [R] How to clear R memory in a for loop

2014-10-21 Thread Prof Brian Ripley
On 21/10/2014 15:47, Dimitri Liakhovitski wrote: I will try with .wav files and report back. So far, I am not sure I understood what could be done (if anything) to fix it... This is nothing to do with my reply! The posting guide asked you to contact the tuneR maintainer *before posting*. Wha

Re: [R] How to clear R memory in a for loop

2014-10-21 Thread Dimitri Liakhovitski
I will try with .wav files and report back. So far, I am not sure I understood what could be done (if anything) to fix it... On Tue, Oct 21, 2014 at 2:26 AM, Prof Brian Ripley wrote: > On 20/10/2014 17:53, John McKown wrote: >> >> On Mon, Oct 20, 2014 at 10:30 AM, Dimitri Liakhovitski < >> dimitr

Re: [R] How to clear R memory in a for loop

2014-10-20 Thread Prof Brian Ripley
On 20/10/2014 17:53, John McKown wrote: On Mon, Oct 20, 2014 at 10:30 AM, Dimitri Liakhovitski < dimitri.liakhovit...@gmail.com> wrote: Dear Rers, I am trying to run a for-loop in R. During each iteration I read in an mp3 file and do some basic processing. If I do what I need to do for each fi

Re: [R] How to clear R memory in a for loop

2014-10-20 Thread Dimitri Liakhovitski
Thank you, everybody. Bill - do I interpret your response correctly if I say: we should check if tuneR is handling .wav files better than mp3 files. On Mon, Oct 20, 2014 at 12:53 PM, William Dunlap wrote: > tuneR::readMP3 may not be allocating (or freeing) memory correctly. On both > Linux and W

Re: [R] How to clear R memory in a for loop

2014-10-20 Thread William Dunlap
tuneR::readMP3 may not be allocating (or freeing) memory correctly. On both Linux and Windows I get the following (where 'jingle.mp3' is a sample mp3 that comes with Processing 2.1 which has a quarter million samples in it). If I do this as a sequence of top-level expression instead of as a for l

Re: [R] How to clear R memory in a for loop

2014-10-20 Thread John McKown
On Mon, Oct 20, 2014 at 10:30 AM, Dimitri Liakhovitski < dimitri.liakhovit...@gmail.com> wrote: > Dear Rers, > > I am trying to run a for-loop in R. > During each iteration I read in an mp3 file and do some basic processing. > If I do what I need to do for each file one by one - it works fine. > B

Re: [R] How to clear R memory in a for loop

2014-10-20 Thread Jeff Newmiller
It is your responsibility (not mine) to simplify your example to the point where it is small, self-contained, and reproducible (see the footer of this message). In fact, doing so often highlights the issue to you before you share it. If any old downloadable mp3 file can be used to reproduce the

Re: [R] How to clear R memory in a for loop

2014-10-20 Thread Dimitri Liakhovitski
Jeff, here is what I do with each file using library(tuneR): b<-readMP3("cairnomount.mp3") myrange<-range(b@left) write.table(myrange,"x myrange.txt",sep="\t") Would you like me to attach a bunch of large mp3 files? I don't feel I have the right to clog people's inboxes with large files. Thanks

Re: [R] How to clear R memory in a for loop

2014-10-20 Thread Jeff Newmiller
You don't say what processing you are doing.. the answer to your question is very likely there. To communicate effectively on this mailing list, self-contained examples are needed. And in order to not corrupt the example you will need to post in plain text. --

[R] How to clear R memory in a for loop

2014-10-20 Thread Dimitri Liakhovitski
Dear Rers, I am trying to run a for-loop in R. During each iteration I read in an mp3 file and do some basic processing. If I do what I need to do for each file one by one - it works fine. But once I start running a loop, it soon runs out of memory and says: can't allocate a vector of size... In e