<div dir="ltr">On Sat, Jul 19, 2008 at 11:35 PM, Chaddaï Fouché &lt;<a href="mailto:chaddai.fouche@gmail.com">chaddai.fouche@gmail.com</a>&gt; wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="Ih2E3d">2008/7/19 Krzysztof Skrzętnicki &lt;<a href="mailto:gtener@gmail.com">gtener@gmail.com</a>&gt;:<br>
</div><div class="Ih2E3d">&gt; I forgot to mention that the memory consumption is several times higher than<br>
&gt; file size. On 8,3 Mb file:<br>
&gt;&gt; 532 MB total memory in use (4 MB lost due to fragmentation).<br>
&gt;<br>
&gt; Having that 8 Mb in memory is not the problem. 532 Mb is another story. In<br>
&gt; general, the program consumes roughly 64 times more memory than file size<br>
&gt; and it scales linearly.<br>
<br>
</div>You should be using ByteString, though this problem would be<br>
alleviated if you were consuming the file as a stream.<br>
<font color="#888888"><br>
</font></blockquote></div><br>Since ANSI color codes doesn&#39;t contain characters like newline or
space, I have simply split input file into such lines. Now the whole
program behaves much better: GC time is below 10% and memory
consumption dropped to 74 Mb per thread. It&#39;s still a lot of memory
though and it certainly holds much more than one line of text.<br>
<br>
Best regards<br>
Christopher Skrzętnicki<br></div>