<font class="Apple-style-span" face="Times"><span class="Apple-style-span" style="border-collapse: collapse; -webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; font-size: medium;"><div>Hello,</div>
<div><br></div><div>I have a strange (low level) problem with the Data.Text library.</div><div><br></div><div>Running the simple program below on a certain text file causes a low level error.</div><div> </div><div><br></div>
<div><div> runghc ./ReadFiles.hs testfile </div><div>ghc(16402,0xb0103000) malloc: *** error for object 0x2501710: pointer being freed was not allocated</div><div>*** set a breakpoint in malloc_error_break to debug</div><div>
ghc(16402,0xb0103000) malloc: *** error for object 0x2501710: pointer being freed was not allocated</div><div>*** set a breakpoint in malloc_error_break to debug</div><div>ReadFiles.hs: testfile: hGetContents: invalid argument (Illegal byte sequence)</div>
</div><div><br></div><div><br></div><div>module Main where</div><div><br></div><div>import qualified <a href="http://Data.Text.IO">Data.Text.IO</a> as TI</div><div>import qualified Data.Text as T</div><div>import System</div>
<div><br></div><div><br></div><div>main = do</div><div>  args &lt;- getArgs</div><div>  let fileName:_  = args</div><div>  txt &lt;- TI.readFile fileName</div><div><br></div><div>  putStrLn $ show txt</div><div><br></div>
<div><br></div><div>Unfortunately I can &#39;t post the specific data file. </div><div>But according to the file program it is a text file with :</div><div><div> Non-ISO extended-ASCII text, with very long lines, with CRLF, LF line terminators encoding.</div>
<div><br></div><div><br></div><div>How can I debug this problem ? What would you guys do ?  Trying gdb ? </div><div><br></div> thanks in advance,</div><div><br></div><div>Pieter</div><div><br></div></span></font><br>-- <br>
Pieter Laeremans &lt;<a href="mailto:pieter@laeremans.org">pieter@laeremans.org</a>&gt;<br><br>&quot;The future is here. It&#39;s just not evenly distributed yet.&quot;  W. Gibson<br>