[Haskell-beginners] space leak
felipe.lessa at gmail.com
Mon Feb 15 13:24:38 EST 2010
On Tue, Feb 16, 2010 at 12:44:51AM +0900, Uchida Yasuo wrote:
> The memory usage seems to depend on the argument(=17000) passed.
> On my MacBook(Core2 Duo 2.0GHz), 16000 works fine.
The default chunk size for bytestring-0.9.1.5 is 32k . I
don't know why 16k is the magical number here. However, you
strictly compute take. When the number of bytes you take is
available in the first chunk, everything is done. If you need
more then one chunk, then that bang patter ! will force only the
*first* chunk, the others will be take'en lazily.
You can try to verify this by using L.toChunks and noting how
many chunks are being created.
More information about the Beginners