<instructions>Your goal is to analyze the following comment and estimate how highly it will be upvoted by the Hacker News community.</instructions><comment><author>mcguire</author><text>&amp;quot;&lt;i&gt;How does the approach in mitten compare to Automatic Reference Counting in Objective-C (and I think Swift too)? From my experience, ARC can still add a surprising amount of memory management overhead to a program and needs a lot of hand-holding to keep that overhead down to an acceptable level (e.g. low single-digit percentage of overall execution time in programs that talk to Obj-C APIs a lot). I would be surprised if a &amp;quot;traditional GC&amp;quot; can do any worse in that regard (maybe reference counting smears the overhead over a wider area, e.g. no obvious spikes, but instead &amp;quot;death by a thousand cuts&amp;quot;).&lt;/i&gt;&amp;quot;&lt;p&gt;The reference counts have to be incremented when a new reference is made and decremented when one is deleted; freeing the memory when the count goes to zero. (This activity is cache- and atomicity-unfriendly (in the presence of threads).)  A sufficiently smart compiler can omit many if not most of the count activity, but this kind of static analysis promises to remove all of it.&lt;p&gt;Further, reference counting has difficulty with circular references as the counts never go to zero. This should also be able to handle that.&lt;p&gt;Both this and reference counting are likely victims of the &amp;quot;death by a thousand cuts&amp;quot; you mention, as well as &amp;quot;drop the last pointer to a large structure and wait for a long time while the pieces are deleted&amp;quot;---the reference counting equivalent of a stop-the-world-and-trace garbage collection.</text><parent_chain><item><author>flohofwoe</author><text>&amp;gt; This means that it maintains the ability to insert freeing code at appropriate program points, without putting restrictions on how you write your code.&lt;p&gt;How does the approach in mitten compare to Automatic Reference Counting in Objective-C (and I think Swift too)? From my experience, ARC can still add a surprising amount of memory management overhead to a program and needs a lot of hand-holding to keep that overhead down to an acceptable level (e.g. low single-digit percentage of overall execution time in programs that talk to Obj-C APIs a lot). I would be surprised if a &amp;quot;traditional GC&amp;quot; can do any worse in that regard (maybe reference counting smears the overhead over a wider area, e.g. no obvious spikes, but instead &amp;quot;death by a thousand cuts&amp;quot;).&lt;p&gt;One thing I&amp;#x27;d like to see in modern languages is to encourage and simplify working with an (almost) entirely static memory layout, and make manipulations inside this static memory layout safe. This static memory layout doesn&amp;#x27;t need to be magically derived by the compiler as long as the language offers features to easily describe this memory layout upfront.&lt;p&gt;A lot of data structures in applications don&amp;#x27;t need to live in &amp;quot;short-lived&amp;quot; memory regions, but they often do because that&amp;#x27;s what today&amp;#x27;s languages either encourage (e.g. when built on the OOP philosophy), or what happens under the hood without much control from the code (e.g. in &amp;quot;reference-heavy&amp;quot; languages like Javascript, Java or C# - or even &amp;quot;modern C++&amp;quot; if you do memory management via smart pointers).&lt;p&gt;Minimizing data with dynamic lifetime, and maximing data with static lifetime could mean less complexity in the language and runtime (e.g. lifetime tracking by the compiler, or runtime memory management mechanisms like refcounting or GCs).</text></item></parent_chain></comment><story><title>Show HN: Micro-mitten – Research language with compile-time memory management</title><url>https://github.com/doctorn/micro-mitten</url><text>I&amp;#x27;ve been working on implementing the compile-time approach to memory management described in this thesis (https:&amp;#x2F;&amp;#x2F;www.cl.cam.ac.uk&amp;#x2F;techreports&amp;#x2F;UCAM-CL-TR-908.pdf) for some time now - some of the performance results look promising! (Although some less so...) I think it would be great to see this taken further and built into a more complete functional language.</text></story>
<instructions>Your goal is to analyze the following comment and estimate how highly it will be upvoted by the Hacker News community.</instructions><comment><author>scott_s</author><text>From the ASAP dissertation (&lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;www.cl.cam.ac.uk&amp;#x2F;techreports&amp;#x2F;UCAM-CL-TR-908.pdf&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;www.cl.cam.ac.uk&amp;#x2F;techreports&amp;#x2F;UCAM-CL-TR-908.pdf&lt;/a&gt;):&lt;p&gt;&amp;gt; Reference counting, like asap, is a safe, synchronous memory management strategy. However, rc
approximates waste by unreachability which is less timely than asap’s approximation by Access.&lt;p&gt;I think a more careful reading of the work is required to distinguish the precise meanings of &amp;quot;unreachability&amp;quot; and &amp;quot;access&amp;quot; in this context.</text><parent_chain><item><author>flohofwoe</author><text>&amp;gt; This means that it maintains the ability to insert freeing code at appropriate program points, without putting restrictions on how you write your code.&lt;p&gt;How does the approach in mitten compare to Automatic Reference Counting in Objective-C (and I think Swift too)? From my experience, ARC can still add a surprising amount of memory management overhead to a program and needs a lot of hand-holding to keep that overhead down to an acceptable level (e.g. low single-digit percentage of overall execution time in programs that talk to Obj-C APIs a lot). I would be surprised if a &amp;quot;traditional GC&amp;quot; can do any worse in that regard (maybe reference counting smears the overhead over a wider area, e.g. no obvious spikes, but instead &amp;quot;death by a thousand cuts&amp;quot;).&lt;p&gt;One thing I&amp;#x27;d like to see in modern languages is to encourage and simplify working with an (almost) entirely static memory layout, and make manipulations inside this static memory layout safe. This static memory layout doesn&amp;#x27;t need to be magically derived by the compiler as long as the language offers features to easily describe this memory layout upfront.&lt;p&gt;A lot of data structures in applications don&amp;#x27;t need to live in &amp;quot;short-lived&amp;quot; memory regions, but they often do because that&amp;#x27;s what today&amp;#x27;s languages either encourage (e.g. when built on the OOP philosophy), or what happens under the hood without much control from the code (e.g. in &amp;quot;reference-heavy&amp;quot; languages like Javascript, Java or C# - or even &amp;quot;modern C++&amp;quot; if you do memory management via smart pointers).&lt;p&gt;Minimizing data with dynamic lifetime, and maximing data with static lifetime could mean less complexity in the language and runtime (e.g. lifetime tracking by the compiler, or runtime memory management mechanisms like refcounting or GCs).</text></item></parent_chain></comment><story><title>Show HN: Micro-mitten – Research language with compile-time memory management</title><url>https://github.com/doctorn/micro-mitten</url><text>I&amp;#x27;ve been working on implementing the compile-time approach to memory management described in this thesis (https:&amp;#x2F;&amp;#x2F;www.cl.cam.ac.uk&amp;#x2F;techreports&amp;#x2F;UCAM-CL-TR-908.pdf) for some time now - some of the performance results look promising! (Although some less so...) I think it would be great to see this taken further and built into a more complete functional language.</text></story>