Hi guys,<div><br></div><div>I&#39;ve started playing with Iteratee and Enumerators: very cool and addictive stuff.</div><div><br></div><div>I have wrote this simple code:</div><div><br></div><div><a href="https://gist.github.com/3899017">https://gist.github.com/3899017</a></div>
<div><br></div><div>In a nutshell, it gives back the number of occurences for a single char in case the argument passed from the command line is a single char,</div><div>or the number of lines of the entire file.</div><div>
<br></div><div>I&#39;ve tried it first on a small file (~100MB) and then on a huge one (~3GB). As far as I understood Iteratee IO should be a smart way to do IO,</div><div>avoiding to keep the entire file in memory; what I observe in the second case, instead, is a sort of memory leak. The memory grows and grows</div>
<div>until the entire machine hangs.</div><div><br></div><div>If I split the huge file in &quot;small&quot; chunks, memory comsumption is still high but the computation terminates and is fast.</div><div><br></div><div>So my two questions:</div>
<div><br></div><div>a) What am I missing? Should be memory used be constant? And how can I achieve this purpose?</div><div>b) I&#39;m using the package enumerator because as far as I can see is the most used. How does it compares with &quot;iteratee&quot;? Which of the two are more performant?</div>
<div><br></div><div><br></div><div>Bye and thanks,</div><div>A.</div>