A number of spots in the J source follow this pattern, or similar:
store the current stack top in variable old.
for(...) {
add something to boxed array w.
call gc(w,old), putting w in non-recursive form.
}
(A particular example is cp.c, lines 91--97, which performs (v^:l x)
where l is an integer list).
If you look at
http://www.jsoftware.com/pipermail/source/2016-May/000723.html there was a
response to Henry' question:
* how J-like sequences, such as (' ' , }. y), are written in the C code
F1(blankfirst){R over(sc(' '),behead(w));}
Now what's being executed in the for loop can be a function such as
blankfirst(). Such functions do not free arrays that are used in doing
their nefarious work, leaving it to the caller to do that. In a for loop,
these arrays can accumulate until you exit the for loop, until you
eventually return to a caller (or caller of a caller) that WOULD do the
freeing. The gc(w,old) was put there to avoid that happening, to avoid
having the stuff accumulating.
This was the original reason why it was done that way. I have no comment
on new better ways consistent with the changes y'all have made, or new
better ways to better exploit the changes.
On Thu, May 19, 2016 at 2:36 AM, Roger Hui <[email protected]>
wrote:
> > (and question for Roger)
>
> I am heavily engaged at the moment and will not be able to answer for a
> few days.
>
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm