<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Malloc on Shai Asher</title><link>https://slow-is-smooth.io/tags/malloc/</link><description>Recent content in Malloc on Shai Asher</description><generator>Hugo</generator><language>en-gb</language><lastBuildDate>Sun, 11 Nov 2018 09:00:00 +0200</lastBuildDate><atom:link href="https://slow-is-smooth.io/tags/malloc/index.xml" rel="self" type="application/rss+xml"/><item><title>Where the Memory Goes</title><link>https://slow-is-smooth.io/blog/where-the-memory-goes/</link><pubDate>Sun, 11 Nov 2018 09:00:00 +0200</pubDate><guid>https://slow-is-smooth.io/blog/where-the-memory-goes/</guid><description>&lt;p&gt;A Python 3.7 process makes four million floats, 130 MB of resident memory, and then deletes all but&#10;one in every thousand. Four thousand floats are left, about 96 kilobytes of actual data. The process&#10;still uses 100 MB. Delete those last four thousand and it drops to 7 MB at once. Nothing leaked: the&#10;memory was in use, by the allocator&amp;rsquo;s bookkeeping rather than by the program, because CPython hands&#10;memory back to the operating system only in 256 KiB pieces, and only when every object in a piece&#10;is gone.&lt;/p&gt;</description></item><item><title>The Allocator Under Every new</title><link>https://slow-is-smooth.io/blog/the-allocator-under-every-new/</link><pubDate>Sun, 07 Oct 2018 09:00:00 +0300</pubDate><guid>https://slow-is-smooth.io/blog/the-allocator-under-every-new/</guid><description>&lt;p&gt;Ask Go&amp;rsquo;s heap for 33 bytes and it hands back 48. Ask for 32,769 and it hands back 40,960. Keep&#10;every second one of a million small integers and you free nothing at all. And until August, a C&#10;library that mapped 64 kilobytes of memory in the wrong place could kill a Go program as soon as its&#10;heap grew into that place, with an error that blamed neither. Go 1.11, released on 24 August,&#10;fixed the last of these by changing where the heap lives. The others are how Go&amp;rsquo;s allocator is&#10;designed, and they are worth knowing.&lt;/p&gt;</description></item></channel></rss>