Skip to content
Prev 25181 / 63424 Next

R scripts slowing down after repeated called to compiled code

Vladimir:

Thanks for your response.  I have done as you requested (with a smaller
dataset--the patterns are still there).  Here is the gc()-laden output.

I don;t fully understand the meaning of all parts of these reports.  But
it does look like the number of objects grows (and it grows faster on
the larger, slower problem).  But how can I use this information to
narrow down the cause?

As far as your other suggestions, my PROTECTs and UNPROTECTs are all
balanced (I'd get a stack imbalance if they weren't).  One thing I am
doing is duplicating the SEXP's that are passed from R, and working with
the copies.  I unprotect the copies at the end of the function.  There
are other, various VECTOR_ELT's in my code.

So where do I go from there?

Michael



Dataset  B06   Iteration:   1
Garbage collection 67 = 33+9+25 (level 2) ...
778324 cons cells free (42%)
32.4 Mbytes of heap free (28%)

Dataset  B06   Iteration:   2
Garbage collection 92 = 52+11+29 (level 2) ...
778303 cons cells free (42%)
43.9 Mbytes of heap free (34%)

Dataset  B06   Iteration:   3
Garbage collection 112 = 69+12+31 (level 2) ...
778303 cons cells free (42%)
43.9 Mbytes of heap free (34%)

Dataset  B06   Iteration:   4
Garbage collection 126 = 79+13+34 (level 2) ...
778303 cons cells free (42%)
50.7 Mbytes of heap free (38%)

Dataset  B06   Iteration:   5
Garbage collection 139 = 89+14+36 (level 2) ...
778303 cons cells free (42%)
50.7 Mbytes of heap free (38%)

Dataset  B06   Iteration:   6
Garbage collection 149 = 95+15+39 (level 2) ...
778303 cons cells free (42%)
58.0 Mbytes of heap free (41%)

Dataset  B06   Iteration:   7
Garbage collection 157 = 101+15+41 (level 2) ...
778303 cons cells free (42%)
58.0 Mbytes of heap free (41%)

Dataset  B06   Iteration:   8
Garbage collection 165 = 107+15+43 (level 2) ...
778303 cons cells free (42%)
58.0 Mbytes of heap free (41%)

Dataset  B06   Iteration:   9
Garbage collection 173 = 112+16+45 (level 2) ...
778303 cons cells free (42%)
58.0 Mbytes of heap free (41%)

Dataset  B06   Iteration:   10
Garbage collection 181 = 118+16+47 (level 2) ...
778303 cons cells free (42%)
58.0 Mbytes of heap free (41%)

Dataset  B06   Iteration:   11
Garbage collection 188 = 123+16+49 (level 2) ...
778303 cons cells free (42%)
58.0 Mbytes of heap free (41%)

Dataset  B06   Iteration:   12
Garbage collection 195 = 128+16+51 (level 2) ...
778303 cons cells free (42%)
58.0 Mbytes of heap free (41%)

Dataset  B06   Iteration:   13\
Garbage collection 202 = 132+17+53 (level 2) ...
778303 cons cells free (42%)
58.0 Mbytes of heap free (41%)

Dataset  B06   Iteration:   14
Garbage collection 209 = 137+17+55 (level 2) ...
778303 cons cells free (42%)
58.0 Mbytes of heap free (41%)
On Fri, 2007-05-25 at 19:29 -0400, Vladimir Dergachev wrote: