[Haskell-cafe] Space leak in WAI 3.0 application
Gregory Collins
greg at gregorycollins.net
Wed Nov 19 18:30:23 UTC 2014
On Tue, Nov 18, 2014 at 4:59 PM, Thomas Koster <tkoster at gmail.com> wrote:
> Why does version A not process the LBS in constant space?
>
The lazy bytestring is let-lifted out of the function so that subsequent
calls reuse the same heap value.
> What in version A is preventing the GC from collecting the LBS chunks
> after they have been fed to Warp?
>
The value is re-used (and the closure holds a reference) so the GC can't
collect it.
What is it about version B that permits the LBS chunks to be collected?
>
The allocation is performed underneath the lambda in version B and so you
get a fresh copy every time.
G
--
Gregory Collins <greg at gregorycollins.net>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20141119/912cd116/attachment.html>
More information about the Haskell-Cafe
mailing list