Search code examples
haskellghclazy-evaluationmmapbytestring

Segfault reading lazy bytestring past 2^18 bytes


Consider the following code: http://hpaste.org/90394

I am memory mapping a large 460mb file to a lazy ByteString. The length of the ByteString reports 471053056.

When nxNodeFromID file 110000 is changed to a lower node ID, ie: 10000, it works perfectly. However; as soon as I try and serialize anything past exactly 2^18 bytes (262144) of the ByteString I get Segmentation fault/access violation in generated code and termination.

I'm running Windows and using GHC 7.4.2.

Please advise whether this is my fault, or some issue with the laziness, or, some issue with Haskell.


Solution

  • Note that I have updated mmap to correctly include NOINLINE pragma at strategic point in the code. mmap-0.5.9 available for grabs. Let me know if the issue persists. Edit: yes, I'm the author of mmap.