Proposal: plug the space leak in transpose

David Feuer david.feuer at gmail.com
Mon Aug 24 01:35:09 UTC 2020


Data.List.transpose, unfortunately, can potentially leak space. The problem
is that it walks a list of lists twice: once to get the heads and once to
get the tails. Depending on the way the result is consumed, it's possible
that heads or tails that are never used will be retained by the garbage
collector. I have a fix[*] that probably makes the function slower in
typical cases, but that plugs the leak. What do y'all say?

* https://gitlab.haskell.org/ghc/ghc/-/merge_requests/3882
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20200823/a7ff2fcf/attachment.html>


More information about the Libraries mailing list