On Thu, Mar 8, 2018 at 5:01 AM, Danil Osipchuk <danil.osipc...@gmail.com> wrote:
> The issue with 2!:2 certainly is(was) not only with the memory management.
> If I remember correctly, there is a table (may be the 1!:20) which tracks
> files in use and their descriptors ( FDs or FILE*s - again not sure now)
> and the supporting 2!:2 implementation is inconsistent when filling it
> http://jsoftware.com/pipermail/beta/2017-April/008773.html

Thanks for that link. The memory issues is one thing, but I think most
of the other problems in that link are due to the file routines
expecting seekable streams but the streams from 2!:2 aren't seekable.
From that email:

> NB. I would expect a small integers for stdin/stdout as file descriptors,
> but that is just expectation of course, may be this is something else

The integers are actually FILE* pointers, that's why they're so large.
2!:2 does an "fdopen" on the actual file handle, which is a small
integer, and puts the FILE* pointer return into the array. I believe
the 1!:1, etc expect FILE*.

I think the various 1!:n routines will need to be tested against the
file handles returned by 2!:2, and refactored to avoid seeking, etc.
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to