<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Space Leak Zoo - Medium]]></title>
        <description><![CDATA[Collection of space leaks in the wild - Medium]]></description>
        <link>https://medium.com/space-leak-zoo?source=rss----9a6fb2bf0fe5---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Space Leak Zoo - Medium</title>
            <link>https://medium.com/space-leak-zoo?source=rss----9a6fb2bf0fe5---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 18:30:53 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/space-leak-zoo" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Thunk Accumulating Record]]></title>
            <link>https://medium.com/space-leak-zoo/thunk-accumulating-record-3bf694c5b01?source=rss----9a6fb2bf0fe5---4</link>
            <guid isPermaLink="false">https://medium.com/p/3bf694c5b01</guid>
            <category><![CDATA[haskell]]></category>
            <dc:creator><![CDATA[Mitsutoshi Aoe]]></dc:creator>
            <pubDate>Sun, 13 Dec 2015 09:00:30 GMT</pubDate>
            <atom:updated>2015-12-13T09:00:29.672Z</atom:updated>
            <content:encoded><![CDATA[<p>Thunk accumulating records or tuples are probably one of the most popular space leaks in Haskell.</p><h4>Classification</h4><p>Thunk accumulating records are classified as a thunk leak.</p><h4>Habitat</h4><p>They typically appear in a combination of a recursive (or repeatedly applying) function and a record type which have lazy fields or a standard tuple.</p><h4>Fix</h4><p>If the leak is from a field in a record, the easiest fix is to make the fields strict. If it’s a tuple, the thunk needs to be evaluated before putting it into the tuple. You can use either seq or the BangPatterns language extension.</p><h4>Eyewitness reports</h4><p>The <a href="https://hackage.haskell.org/package/retry">retry</a> package has introduced the <a href="https://hackage.haskell.org/package/retry-0.7.0.1/docs/Control-Retry.html#t:RetryStatus">RetryStatus</a> type as of v0.7. In the development of v0.7, there were space leaks associated with this type.</p><p>In the <a href="https://github.com/Soostone/retry/blob/a2ef0f0c249e5da544bd44452802381e83483c1c/src/Control/Retry.hs#L278-L279">retrying</a> and <a href="https://github.com/Soostone/retry/blob/a2ef0f0c249e5da544bd44452802381e83483c1c/src/Control/Retry.hs#L353-L354">recovering</a>, the recursive functions evaluate their parameters strictly, but the fields in RetryStatus are lazy. Therefore those fields accumulates thunks each iteration.</p><p><a href="https://github.com/Soostone/retry/commit/8f631faf92eb0ee6a9047ee019239d7daf410a65">The fix</a> was to make these fields strict.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3bf694c5b01" width="1" height="1" alt=""><hr><p><a href="https://medium.com/space-leak-zoo/thunk-accumulating-record-3bf694c5b01">Thunk Accumulating Record</a> was originally published in <a href="https://medium.com/space-leak-zoo">Space Leak Zoo</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>