Still seems to hold on to a file handle somewhere :(  <div><br></div><div>Marc - is there any chance you could have a look - or try to replicate under OSX?  I've looked through _io.scm and at the ##open-process-generic prim, but it's still over my head.  I really would like to use Gambit for some scripting duties over all our game data (thousands of media files).  Thanks,</div>
<div><br></div><div>  Adam<br><br></div><div><br><div class="gmail_quote">On Fri, Sep 9, 2011 at 5:36 PM, Mikael <span dir="ltr"><<a href="mailto:mikael.rcv@gmail.com">mikael.rcv@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Huh. Just for more debug, what about, for each process port created, make a copy of it but with a weak GC reference, then after with-input-from-process is done do ##gc, and check if the port still exists. Does it? Mikael<div>
<div></div><div class="h5"><br>

<br><div class="gmail_quote">2011/9/10 Adam King <span dir="ltr"><<a href="mailto:akingcoder@gmail.com" target="_blank">akingcoder@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


I placed a #gc in two different locations (before and after each call to (do-process)), but still the same error message.  I also tried with a compiled version, same issue.  Thanks for the suggestion though.<div><br></div>



<div><font color="#888888">  Adam</font><div><div></div><div><br><div><br><br><div class="gmail_quote">On Fri, Sep 9, 2011 at 5:16 PM, Mikael <span dir="ltr"><<a href="mailto:mikael.rcv@gmail.com" target="_blank">mikael.rcv@gmail.com</a>></span> wrote:<br>


<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
(While making a real solution to the problem, and as a part of debugging, run ##gc right at the end of each do-process . Does it have any effect?)<br><br><div class="gmail_quote"><div><div></div><div>2011/9/9 Adam King <span dir="ltr"><<a href="mailto:akingcoder@gmail.com" target="_blank">akingcoder@gmail.com</a>></span><br>





</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div></div><div>I need to descend a directory structure with ~5000 files in it and run an external process on each to gether information on each file.  However, after running over about 250 files, I get a "Too many open files" error.  250 is probably OSX default max open file limit - but I don't understand why the 'with-input-from-process' doesn't appear to be closing its file handle?  I also tried with 'open-input-process' and 'open-process' and manually calling 'close-input-port' but didn't help.  Here's a small script that shows the exact same prob:<div>






<br></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><div><font face="'courier new', monospace">(define (test-fn)</font></div></div><div><div><font face="'courier new', monospace">  </font></div>






</div><div><div><font face="'courier new', monospace">  (define (do-process)</font></div></div><div><div><font face="'courier new', monospace">    (with-input-from-process (list path: "pwd") read-all))</font></div>






</div><div><div><font face="'courier new', monospace"><br></font></div></div><div><div><font face="'courier new', monospace">  (let loop [(count 2000)]</font></div></div><div><div><font face="'courier new', monospace">    (if (> count 0)</font></div>






</div><div><div><font face="'courier new', monospace">        (begin</font></div></div><div><div><font face="'courier new', monospace">          (do-process)</font></div></div><div><div><font face="'courier new', monospace">          (loop (- count 1)))</font></div>






</div><div><div><font face="'courier new', monospace">        (println "Done"))))</font></div></div><div><div><font face="'courier new', monospace"><br></font></div></div><div><div><font face="'courier new', monospace"><br>






</font></div></div><div><div><font face="'courier new', monospace">(test-fn)</font></div></div><div><font face="'courier new', monospace"><br></font></div></blockquote><font face="arial, helvetica, sans-serif">And the output:</font><div>






<font face="arial, helvetica, sans-serif"><br></font></div><div><div>bigmac:iosTexConverter aking$ gsc -v</div><div>v4.6.1 20110519175028 i386-apple-darwin10.8.0 "./configure /usr/local/Gambit-C/share/config.site /usr/local/Gambit-C/etc/config.site"</div>






<div><br></div><div>bigmac:iosTexConverter aking$ gsi ./test.scm </div><div>*** ERROR IN loop, "test.scm"@9.11 -- Too many open files</div><div>(with-input-from-process '(path: "pwd") '#<procedure #2 read-all>)</div>






<div>bigmac:iosTexConverter aking$ </div></div><div><br></div><div>Running latest from the Gambit git repo and OSX 10.6.8.  As far as I can tell, calling 'pwd' shouldn't be leaving around open file handles.  I also checked the process-status, and it was 0.  Any suggestions?</div>






<br></div></div>_______________________________________________<br>
Gambit-list mailing list<br>
<a href="mailto:Gambit-list@iro.umontreal.ca" target="_blank">Gambit-list@iro.umontreal.ca</a><br>
<a href="https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list" target="_blank">https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list</a><br>
<br></blockquote></div><br>
</blockquote></div><br></div></div></div></div>
</blockquote></div><br>
</div></div></blockquote></div><br></div>