<?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"><channel><title><![CDATA[Today I learned you could do: &#96;go build -gcflags=&quot;-m -m&quot;&#96; to get escape analysis information.]]></title><description><![CDATA[<p>Today I learned you could do: `go build -gcflags="-m -m"` to get escape analysis information.</p><p>Is this what people commonly use in performance work when writing functions? Is there a better way? Is there a rough guide people follow?</p><p>I've never been great at memory management related things or performance engineering so trying to brush up a bit.</p><p><a href="https://mastodon.social/tags/golang" rel="tag">#<span>golang</span></a></p>]]></description><link>https://board.circlewithadot.net/topic/d8f7f487-279a-481d-87f9-68e02244d8a1/today-i-learned-you-could-do-go-build-gcflags-m-m-to-get-escape-analysis-information.</link><generator>RSS for Node</generator><lastBuildDate>Fri, 15 May 2026 07:37:28 GMT</lastBuildDate><atom:link href="https://board.circlewithadot.net/topic/d8f7f487-279a-481d-87f9-68e02244d8a1.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 02 May 2026 17:22:11 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Today I learned you could do: &#96;go build -gcflags=&quot;-m -m&quot;&#96; to get escape analysis information. on Sun, 03 May 2026 01:36:38 GMT]]></title><description><![CDATA[<p><span><a href="/user/purpleidea%40mastodon.social">@<span>purpleidea</span></a></span> usually the problem is a memory leak, too many goroutines, storing data in a slice or map and never clearing it (i. e. another memory leak), etc.  It would be wonderful if pprof could point us to these issues and the related buggy code file and line number</p>]]></description><link>https://board.circlewithadot.net/post/https://infosec.exchange/users/imclaren/statuses/116508078817300605</link><guid isPermaLink="true">https://board.circlewithadot.net/post/https://infosec.exchange/users/imclaren/statuses/116508078817300605</guid><dc:creator><![CDATA[imclaren@infosec.exchange]]></dc:creator><pubDate>Sun, 03 May 2026 01:36:38 GMT</pubDate></item><item><title><![CDATA[Reply to Today I learned you could do: &#96;go build -gcflags=&quot;-m -m&quot;&#96; to get escape analysis information. on Sun, 03 May 2026 01:32:12 GMT]]></title><description><![CDATA[<p><span><a href="/user/purpleidea%40mastodon.social">@<span>purpleidea</span></a></span> yes I think there’s something to that.  I generally use the flame graph / visual output to identify outliers and triage from there.  </p><p>I find pprof deeply unintuitive.  It would be wonderful to be able to import a library to the server which takes the pprof output and points you towards the likely culprit.  Or is a kitchen sink analysis that shows all the pprof output in a comprehensive way.</p>]]></description><link>https://board.circlewithadot.net/post/https://infosec.exchange/users/imclaren/statuses/116508061355235310</link><guid isPermaLink="true">https://board.circlewithadot.net/post/https://infosec.exchange/users/imclaren/statuses/116508061355235310</guid><dc:creator><![CDATA[imclaren@infosec.exchange]]></dc:creator><pubDate>Sun, 03 May 2026 01:32:12 GMT</pubDate></item><item><title><![CDATA[Reply to Today I learned you could do: &#96;go build -gcflags=&quot;-m -m&quot;&#96; to get escape analysis information. on Sat, 02 May 2026 23:04:12 GMT]]></title><description><![CDATA[<p><span><a href="/user/purpleidea%40mastodon.social">@<span>purpleidea</span></a></span> 2/2 My bete noir is always logging local variables that would otherwise be stack allocated  thru a logging go routine which means they have to be on the heap. Expensive but I like my logging. And anyways I am using gRPC libraries that do a lot more allocs per request than my logging so it seems to be ok, but yeah I learned a lot from the escape analysis.</p>]]></description><link>https://board.circlewithadot.net/post/https://mastodon.online/users/jayalane/statuses/116507479436275993</link><guid isPermaLink="true">https://board.circlewithadot.net/post/https://mastodon.online/users/jayalane/statuses/116507479436275993</guid><dc:creator><![CDATA[jayalane@mastodon.online]]></dc:creator><pubDate>Sat, 02 May 2026 23:04:12 GMT</pubDate></item><item><title><![CDATA[Reply to Today I learned you could do: &#96;go build -gcflags=&quot;-m -m&quot;&#96; to get escape analysis information. on Sat, 02 May 2026 23:02:11 GMT]]></title><description><![CDATA[<p><span><a href="/user/purpleidea%40mastodon.social">@<span>purpleidea</span></a></span> I have used that to understand why a given line is triggering allocation which I see is expensive from pprof. I think it is good tool to understand how the language works but not so useful in specific performance tuning runs. </p><p>Allocs put pressure on the GC and minimizing them definitely results in higher thruput for a given deployment size. I start with the profiler and then go from there. 1/2</p>]]></description><link>https://board.circlewithadot.net/post/https://mastodon.online/users/jayalane/statuses/116507471455105709</link><guid isPermaLink="true">https://board.circlewithadot.net/post/https://mastodon.online/users/jayalane/statuses/116507471455105709</guid><dc:creator><![CDATA[jayalane@mastodon.online]]></dc:creator><pubDate>Sat, 02 May 2026 23:02:11 GMT</pubDate></item><item><title><![CDATA[Reply to Today I learned you could do: &#96;go build -gcflags=&quot;-m -m&quot;&#96; to get escape analysis information. on Sat, 02 May 2026 19:00:32 GMT]]></title><description><![CDATA[<p><span><a href="/user/merovius%40chaos.social">@<span>Merovius</span></a></span> Fair enough, me either! I'm definitely not going to the assembly level of things, but getting a rough idea of what's happening and learning how to fix those things is my currently goal. Making progress so far!</p>]]></description><link>https://board.circlewithadot.net/post/https://mastodon.social/users/purpleidea/statuses/116506521270222790</link><guid isPermaLink="true">https://board.circlewithadot.net/post/https://mastodon.social/users/purpleidea/statuses/116506521270222790</guid><dc:creator><![CDATA[purpleidea@mastodon.social]]></dc:creator><pubDate>Sat, 02 May 2026 19:00:32 GMT</pubDate></item><item><title><![CDATA[Reply to Today I learned you could do: &#96;go build -gcflags=&quot;-m -m&quot;&#96; to get escape analysis information. on Sat, 02 May 2026 18:58:37 GMT]]></title><description><![CDATA[<p><span><a href="/user/purpleidea%40mastodon.social">@<span>purpleidea</span></a></span> Not sure. So far, guessing was enough for me, together with looking for red lines in the code listing in the -http pprof view (for CPU and/or memory profiles) got me far enough.<br />I'm not writing *extremely* performance sensitive code, though.</p>]]></description><link>https://board.circlewithadot.net/post/https://chaos.social/users/Merovius/statuses/116506513735144837</link><guid isPermaLink="true">https://board.circlewithadot.net/post/https://chaos.social/users/Merovius/statuses/116506513735144837</guid><dc:creator><![CDATA[merovius@chaos.social]]></dc:creator><pubDate>Sat, 02 May 2026 18:58:37 GMT</pubDate></item><item><title><![CDATA[Reply to Today I learned you could do: &#96;go build -gcflags=&quot;-m -m&quot;&#96; to get escape analysis information. on Sat, 02 May 2026 18:53:13 GMT]]></title><description><![CDATA[<p><span><a href="/user/merovius%40chaos.social">@<span>Merovius</span></a></span> Very helpful, thanks! But you've had good insight into a key part of my question:</p><p>When seeing all those internal functions in pprof (eg: runtime.* etc) short of guessing or assuming, where's the good guide that decodes the list of what you see there that's internal, to map that to reality and changes in my code?</p><p>I've seen a lot of functions that I don't know by heart and haven't read the code yet. Eg: lots of likely goroutine related scheduling and so on...</p>]]></description><link>https://board.circlewithadot.net/post/https://mastodon.social/users/purpleidea/statuses/116506492470900860</link><guid isPermaLink="true">https://board.circlewithadot.net/post/https://mastodon.social/users/purpleidea/statuses/116506492470900860</guid><dc:creator><![CDATA[purpleidea@mastodon.social]]></dc:creator><pubDate>Sat, 02 May 2026 18:53:13 GMT</pubDate></item><item><title><![CDATA[Reply to Today I learned you could do: &#96;go build -gcflags=&quot;-m -m&quot;&#96; to get escape analysis information. on Sat, 02 May 2026 18:52:59 GMT]]></title><description><![CDATA[<p><span><a href="/user/purpleidea%40mastodon.social">@<span>purpleidea</span></a></span> My next life goal is to learn to use Linux perf to find bottlenecks in branch prediction and the page cache and the like ^^</p>]]></description><link>https://board.circlewithadot.net/post/https://chaos.social/users/Merovius/statuses/116506491599665384</link><guid isPermaLink="true">https://board.circlewithadot.net/post/https://chaos.social/users/Merovius/statuses/116506491599665384</guid><dc:creator><![CDATA[merovius@chaos.social]]></dc:creator><pubDate>Sat, 02 May 2026 18:52:59 GMT</pubDate></item><item><title><![CDATA[Reply to Today I learned you could do: &#96;go build -gcflags=&quot;-m -m&quot;&#96; to get escape analysis information. on Sat, 02 May 2026 18:51:35 GMT]]></title><description><![CDATA[<p><span><a href="/user/purpleidea%40mastodon.social">@<span>purpleidea</span></a></span> For real *real* micro-optimization (which I only really do when being overly competitive for Advent of Code) I might look at the generated assembly for instructions and calls that I assumed would have been optimized out.</p>]]></description><link>https://board.circlewithadot.net/post/https://chaos.social/users/Merovius/statuses/116506486057460270</link><guid isPermaLink="true">https://board.circlewithadot.net/post/https://chaos.social/users/Merovius/statuses/116506486057460270</guid><dc:creator><![CDATA[merovius@chaos.social]]></dc:creator><pubDate>Sat, 02 May 2026 18:51:35 GMT</pubDate></item><item><title><![CDATA[Reply to Today I learned you could do: &#96;go build -gcflags=&quot;-m -m&quot;&#96; to get escape analysis information. on Sat, 02 May 2026 18:50:02 GMT]]></title><description><![CDATA[<p><span><a href="/user/purpleidea%40mastodon.social">@<span>purpleidea</span></a></span> If I have a function where I care about stuff not escaping (say, something that parses a string), I use this, yes.<br />For performance in general, I use pprof. Mostly CPU, as that often gives low-hanging fruit for algorithmic improvements. If it points at `runtime.growslice/memalloc/…` as a bottleneck, I might use the memory profile to find allocations (and then *might* use -gcflags=-m to eliminate some).<br />-m -m can also help making functions more inlinable, but that's the long tail.</p>]]></description><link>https://board.circlewithadot.net/post/https://chaos.social/users/Merovius/statuses/116506479960345121</link><guid isPermaLink="true">https://board.circlewithadot.net/post/https://chaos.social/users/Merovius/statuses/116506479960345121</guid><dc:creator><![CDATA[merovius@chaos.social]]></dc:creator><pubDate>Sat, 02 May 2026 18:50:02 GMT</pubDate></item><item><title><![CDATA[Reply to Today I learned you could do: &#96;go build -gcflags=&quot;-m -m&quot;&#96; to get escape analysis information. on Sat, 02 May 2026 17:57:37 GMT]]></title><description><![CDATA[<p><span><a href="https://infosec.exchange/@imclaren">@<span>imclaren</span></a></span> I've definitely being using pprof, but I'm still feeling quite novice at it for now. Trying to figure out if it "just doesn't get any better" and there's an even better way to do this kind of analysis or if it's mostly just a lack of experience and you kind of need to be in the "in circle" to know the tricks.</p>]]></description><link>https://board.circlewithadot.net/post/https://mastodon.social/users/purpleidea/statuses/116506273903398908</link><guid isPermaLink="true">https://board.circlewithadot.net/post/https://mastodon.social/users/purpleidea/statuses/116506273903398908</guid><dc:creator><![CDATA[purpleidea@mastodon.social]]></dc:creator><pubDate>Sat, 02 May 2026 17:57:37 GMT</pubDate></item><item><title><![CDATA[Reply to Today I learned you could do: &#96;go build -gcflags=&quot;-m -m&quot;&#96; to get escape analysis information. on Sat, 02 May 2026 17:54:52 GMT]]></title><description><![CDATA[<p><span><a href="/user/purpleidea%40mastodon.social">@<span>purpleidea</span></a></span> I’ll be interested in answers to this question.  If my code has memory issues I generally use pprof to identify problematic functions.</p>]]></description><link>https://board.circlewithadot.net/post/https://infosec.exchange/users/imclaren/statuses/116506263085076753</link><guid isPermaLink="true">https://board.circlewithadot.net/post/https://infosec.exchange/users/imclaren/statuses/116506263085076753</guid><dc:creator><![CDATA[imclaren@infosec.exchange]]></dc:creator><pubDate>Sat, 02 May 2026 17:54:52 GMT</pubDate></item></channel></rss>