<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Garbage-Collection on Shai Asher</title><link>https://slow-is-smooth.io/tags/garbage-collection/</link><description>Recent content in Garbage-Collection on Shai Asher</description><generator>Hugo</generator><language>en-gb</language><lastBuildDate>Sun, 13 Jan 2019 09:00:00 +0200</lastBuildDate><atom:link href="https://slow-is-smooth.io/tags/garbage-collection/index.xml" rel="self" type="application/rss+xml"/><item><title>A Collector That Never Moves a Thing</title><link>https://slow-is-smooth.io/blog/a-collector-that-never-moves-a-thing/</link><pubDate>Sun, 13 Jan 2019 09:00:00 +0200</pubDate><guid>https://slow-is-smooth.io/blog/a-collector-that-never-moves-a-thing/</guid><description>&lt;p&gt;Make 3.2 gigabytes of short-lived garbage in a Go program, and its garbage collector spends 52&#10;milliseconds of CPU cleaning up after it. Or 3,054 milliseconds. The garbage is identical in both&#10;runs. The difference is what else the program is holding: half a gigabyte of plain numbers costs the&#10;collector almost nothing, and half a gigabyte of objects that hold pointers costs it sixty times as&#10;much. Java&amp;rsquo;s collectors spend a few milliseconds on the same garbage, whichever it is, and .NET gets&#10;through all of it in a quarter of a second. Go&amp;rsquo;s collector does not mind how much garbage there is. It minds what is still alive, and it&#10;looks at all of it, every cycle.&lt;/p&gt;</description></item><item><title>Counting References</title><link>https://slow-is-smooth.io/blog/counting-references/</link><pubDate>Sun, 16 Sep 2018 09:00:00 +0300</pubDate><guid>https://slow-is-smooth.io/blog/counting-references/</guid><description>&lt;p&gt;A parent process builds a list of a million small lists, 184 MB of objects, and forks. The child&#10;never assigns to the list. It only loops over it and reads one number from each element, and when&#10;it&amp;rsquo;s done, 93 MB of the parent&amp;rsquo;s memory has been copied into the child. Reading a Python object&#10;writes to it, because every reference taken and dropped changes the object&amp;rsquo;s reference count, and&#10;the reference count lives in the object. The kernel can&amp;rsquo;t tell a reference count from data. It sees&#10;a write to a shared page and copies the page.&lt;/p&gt;</description></item></channel></rss>