<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Stack on Tony Bai</title><link>https://tonybai.com/tags/stack/</link><description>Recent content in Stack on Tony Bai</description><generator>Hugo</generator><language>zh-cn</language><copyright>2004-2026 Tony Bai. 版权所有.</copyright><lastBuildDate>Thu, 15 Jan 2026 00:00:00 +0800</lastBuildDate><atom:link href="https://tonybai.com/tags/stack/index.xml" rel="self" type="application/rss+xml"/><item><title>内存去哪儿了？一个让大多数 Gopher 都无法清晰回答的问题</title><link>https://tonybai.com/2026/01/15/where-did-the-memory-go-gopher-unanswered-question/</link><pubDate>Thu, 15 Jan 2026 00:00:00 +0800</pubDate><guid>https://tonybai.com/2026/01/15/where-did-the-memory-go-gopher-unanswered-question/</guid><description>本文永久链接 – https://tonybai.com/2026/01/15/where-did-the-memory-go-gopher-unanswered-question 大家好，我是Tony Bai。 &amp;gt; “我的服务内存又在缓慢增长了，pprof 显示不出明显的泄漏点……**内存到底去哪儿了？**” 这句午夜梦回的拷问，或许是许多 Go 开发者心中最深的恐惧。 这一切的根源，可能始于一...</description></item><item><title>解构Go并发之核，与Dmitry Vyukov共探Go调度艺术</title><link>https://tonybai.com/2025/06/18/inside-goroutine-scheduler-column/</link><pubDate>Wed, 18 Jun 2025 00:00:00 +0800</pubDate><guid>https://tonybai.com/2025/06/18/inside-goroutine-scheduler-column/</guid><description>解构Go并发之核，与Dmitry Vyukov共探Go调度艺术 - Tony Bai =============== Tony Bai 一个程序员的心路历程 * Google Go语言编码风格规范 * Google Go语言编码风格规范：指南篇 * Google Go语言编码风格规范：决定篇 * Google Go语言编码风格规范：最佳实践篇 * Go语言第一课FAQ * Go语言进阶课FAQ *...</description></item><item><title>一个字符引发的30%性能下降：Go值接收者的隐藏成本与优化</title><link>https://tonybai.com/2025/04/25/hidden-costs-of-go-value-receiver/</link><pubDate>Fri, 25 Apr 2025 00:00:00 +0800</pubDate><guid>https://tonybai.com/2025/04/25/hidden-costs-of-go-value-receiver/</guid><description>一个字符引发的30%性能下降：Go值接收者的隐藏成本与优化 - Tony Bai =============== Tony Bai 一个程序员的心路历程 * Google Go语言编码风格规范 * Google Go语言编码风格规范：指南篇 * Google Go语言编码风格规范：决定篇 * Google Go语言编码风格规范：最佳实践篇 * Go语言第一课FAQ * Go语言进阶课FAQ * 关...</description></item><item><title>一文搞懂如何在Go包中支持Hash-Based Bisect调试</title><link>https://tonybai.com/2024/11/24/how-to-support-hash-based-bisect-in-go-package/</link><pubDate>Sun, 24 Nov 2024 00:00:00 +0800</pubDate><guid>https://tonybai.com/2024/11/24/how-to-support-hash-based-bisect-in-go-package/</guid><description>本文永久链接 – https://tonybai.com/2024/mm/dd/how-to-support-hash-based-bisect-in-go-package bisect是一个英文动词，意为“二分”或“分成两部分”。在数学和计算机科学中，通常指将一个区间或一个集合分成两个相等的部分。 对于程序员来说，最熟悉的bisect应用莫过于下面两个： * 算法中的二分查找(binary se...</description></item><item><title>理解unsafe-assume-no-moving-gc包</title><link>https://tonybai.com/2023/04/16/understanding-unsafe-assume-no-moving-gc/</link><pubDate>Sun, 16 Apr 2023 00:00:00 +0800</pubDate><guid>https://tonybai.com/2023/04/16/understanding-unsafe-assume-no-moving-gc/</guid><description>本文永久链接 – https://tonybai.com/2023/04/16/understanding-unsafe-assume-no-moving-gc 1\. 背景 ------ 在之前的《Go与神经网络：张量计算》一文中，不知道大家是否发现了，所有例子代码执行时，前面都加了一个环境变量ASSUME\_NO\_MOVING\_GC\_UNSAFE\_RISK\_IT\_WITH，就像下面...</description></item><item><title>手把手教你使用ANTLR和Go实现一门DSL语言（第五部分）：错误处理</title><link>https://tonybai.com/2022/05/30/an-example-of-implement-dsl-using-antlr-and-go-part5/</link><pubDate>Mon, 30 May 2022 00:00:00 +0800</pubDate><guid>https://tonybai.com/2022/05/30/an-example-of-implement-dsl-using-antlr-and-go-part5/</guid><description>本文永久链接 – https://tonybai.com/2022/05/30/an-example-of-implement-dsl-using-antlr-and-go-part5 无论是端应用还是云应用，要上生产环境，有一件事必须要做好，那就是**错误处理**。在本系列前面的文章中，我们设计了文法与语法、建立并验证了语义模型，但我们没有特别关注错误处理。在这一篇中，我们就来补上这个环节。 D...</description></item><item><title>手把手教你使用ANTLR和Go实现一门DSL语言（第四部分）：组装语义模型并测试DSL</title><link>https://tonybai.com/2022/05/28/an-example-of-implement-dsl-using-antlr-and-go-part4/</link><pubDate>Sat, 28 May 2022 00:00:00 +0800</pubDate><guid>https://tonybai.com/2022/05/28/an-example-of-implement-dsl-using-antlr-and-go-part4/</guid><description>本文永久链接 – https://tonybai.com/2022/05/28/an-example-of-implement-dsl-using-antlr-and-go-part4 在上一篇文章中，我们为DSL建立了完整的语义模型，我们距离DSL的语法示例真正run起来还差最后一步，那就是基于语法树提取信息(逆波兰式)、组装语义模型，在加载语义模型并实例化各个规则处理器(processor)后...</description></item><item><title>手把手教你使用ANTLR和Go实现一门DSL语言（第三部分）：建立和验证语义模型</title><link>https://tonybai.com/2022/05/27/an-example-of-implement-dsl-using-antlr-and-go-part3/</link><pubDate>Fri, 27 May 2022 00:00:00 +0800</pubDate><guid>https://tonybai.com/2022/05/27/an-example-of-implement-dsl-using-antlr-and-go-part3/</guid><description>本文永久链接 – https://tonybai.com/2022/05/27/an-example-of-implement-dsl-using-antlr-and-go-part3 在前面的系列文章中，我们为气象学家们设计了一门名为**Tdat**的DSL，使用ANTLR的文法规则编写了Tdat的文法，基于该文法生成了Tdat的语法解析器代码并初步验证了文法的正确性，Tdat可以成功将我们编写...</description></item><item><title>使用具名返回值巧妙解决泛型函数返回零值的问题</title><link>https://tonybai.com/2022/05/20/solving-problems-in-generic-function-implementation-using-named-return-values/</link><pubDate>Fri, 20 May 2022 00:00:00 +0800</pubDate><guid>https://tonybai.com/2022/05/20/solving-problems-in-generic-function-implementation-using-named-return-values/</guid><description>本文永久链接 – https://tonybai.com/2022/05/20/solving-problems-in-generic-function-implementation-using-named-return-values Go语言泛型语法特性在Go 1.18版本落地后，不出所料，在github上看到大量的基础容器类型数据结构被用泛型重写。这种重写我觉得是很正常、很自然的，并且实现良好...</description></item><item><title>Go 1.17新特性详解：使用基于寄存器的调用惯例</title><link>https://tonybai.com/2021/08/20/using-register-based-calling-convention-in-go-1-17/</link><pubDate>Fri, 20 Aug 2021 00:00:00 +0800</pubDate><guid>https://tonybai.com/2021/08/20/using-register-based-calling-convention-in-go-1-17/</guid><description>本文永久链接 – https://tonybai.com/2021/08/20/using-register-based-calling-convention-in-go-1-17 除了Go语言特性与go module有重要变化之外，Go编译器与Go运行时也都有着优化与改进，这两方面的变化对Go程序的构建与运行影响巨大。在这个系列的最后一篇中，我们来看看编译器与运行时中那些值得关注的变化。 1. ...</description></item><item><title>Go 1.17中值得关注的几个变化</title><link>https://tonybai.com/2021/08/17/some-changes-in-go-1-17/</link><pubDate>Tue, 17 Aug 2021 00:00:00 +0800</pubDate><guid>https://tonybai.com/2021/08/17/some-changes-in-go-1-17/</guid><description>本文永久链接 – https://tonybai.com/2021/08/17/some-changes-in-go-1-17 Go核心开发团队在去年GopherCon大会上给Go泛型的定调是在2022年2月份的Go 1.18版本中发布，那可是自Go诞生以来语法规范变动最大的一次，这让包括笔者在内的全世界的Gopher们都满怀期待。 不过别忘了，在Go 1.18这个“网红版本”发布前，还有一个“实...</description></item><item><title>使用functrace辅助进行Go项目源码分析</title><link>https://tonybai.com/2021/06/04/go-source-analysis-with-functrace/</link><pubDate>Fri, 04 Jun 2021 00:00:00 +0800</pubDate><guid>https://tonybai.com/2021/06/04/go-source-analysis-with-functrace/</guid><description>本文永久链接 – https://tonybai.com/2021/06/04/go-source-analysis-with-functrace 在《像跟踪分布式服务调用那样跟踪Go函数调用链》一文中，我们介绍了一种跟踪函数调用链的思路，并给出了一种实现functrace：https://github.com/bigwhite/functrace。这个小工具不仅仅是分享给大家的，我自己在工作和学...</description></item><item><title>通过实例理解Go逃逸分析</title><link>https://tonybai.com/2021/05/24/understand-go-escape-analysis-by-example/</link><pubDate>Mon, 24 May 2021 00:00:00 +0800</pubDate><guid>https://tonybai.com/2021/05/24/understand-go-escape-analysis-by-example/</guid><description>本文永久链接 – https://tonybai.com/2021/05/24/understand-go-escape-analysis-by-example 翻看了一下自己的Go文章归档，发现自己从未专门写过有关Go逃逸分析（escape analysis）的文章。关于Go变量的逃逸分析，大多数Gopher其实并不用关心，甚至可以无视。但是如果你将Go应用于性能敏感的领域，要完全压榨出Go应用...</description></item><item><title>Go语言的“黑暗角落”：盘点学习Go语言时遇到的那些陷阱[译]（第二部分）</title><link>https://tonybai.com/2021/03/29/darker-corners-of-go-part2/</link><pubDate>Mon, 29 Mar 2021 00:00:00 +0800</pubDate><guid>https://tonybai.com/2021/03/29/darker-corners-of-go-part2/</guid><description>本文翻译自Rytis Bieliunas的文章《Darker Corners of Go》。 第一部分参见[《Go语言的“黑暗角落”：盘点学习Go语言时遇到的那些陷阱\[译\]（第一部分）》](https://tonybai.com/2021/03/29/darker-corners-of-go-part1) 7\. 字符串和字节数组 ------------ 1) Go中的字符串 Go字符串的内...</description></item><item><title>Go语言的“黑暗角落”：盘点学习Go语言时遇到的那些陷阱[译]（第一部分）</title><link>https://tonybai.com/2021/03/29/darker-corners-of-go-part1/</link><pubDate>Mon, 29 Mar 2021 00:00:00 +0800</pubDate><guid>https://tonybai.com/2021/03/29/darker-corners-of-go-part1/</guid><description>本文翻译自Rytis Bieliunas的文章《Darker Corners of Go》。 &amp;gt; 译注：若干年前，Kyle Quest曾发过一篇名为“50 Shades of Go: Traps, Gotchas, and Common Mistakes for New Golang Devs”的文章，仿效著名的《C Traps and Pitfalls》编写了50条Go语言的陷阱与缺陷，一时在G...</description></item><item><title>BPF和Go：在Linux中内省的现代方式[译]</title><link>https://tonybai.com/2020/12/25/bpf-and-go-modern-forms-of-introspection-in-linux/</link><pubDate>Fri, 25 Dec 2020 00:00:00 +0800</pubDate><guid>https://tonybai.com/2020/12/25/bpf-and-go-modern-forms-of-introspection-in-linux/</guid><description>本文翻译自马可·凯瓦克（Marko Kevac）的《BPF and Go: Modern forms of introspection in Linux》(https://medium.com/bumble-tech/bpf-and-go-modern-forms-of-introspection-in-linux-6b9802682223)。 每个人都有自己喜欢的关于魔法的书。对于一个人来说是托...</description></item><item><title>可视化Go内存管理</title><link>https://tonybai.com/2020/03/10/visualizing-memory-management-in-golang/</link><pubDate>Tue, 10 Mar 2020 00:00:00 +0800</pubDate><guid>https://tonybai.com/2020/03/10/visualizing-memory-management-in-golang/</guid><description>本文翻译自《Visualizing memory management in Golang》。 “内存管理”系列的一部分 在这个由多部分组成的系列文章中，我旨在揭示内存管理背后的概念，并对某些现代编程语言的内存管理机制做更深入的探究。我希望该系列文章可以使您对这些语言在内存管理方面正在发生的事情能有所了解。 在本章中，我们将研究Go编程语言（Golang）的内存管理。和C/C++、Rust等一样，...</description></item><item><title>图解Go内存分配器</title><link>https://tonybai.com/2020/02/20/a-visual-guide-to-golang-memory-allocator-from-ground-up/</link><pubDate>Thu, 20 Feb 2020 00:00:00 +0800</pubDate><guid>https://tonybai.com/2020/02/20/a-visual-guide-to-golang-memory-allocator-from-ground-up/</guid><description>本文翻译自《A visual guide to Go Memory Allocator from scratch (Golang)》。 当我刚开始尝试了解Go的内存分配器时，我发现这真是一件可以令人发疯的事情，因为所有事情似乎都像一个神秘的黑盒(让我无从下手)。由于几乎所有技术魔法都隐藏在抽象之下，因此您需要逐一剥离这些抽象层才能理解它们。 在这篇文章中，我们就来这么做(剥离抽象层去了解隐藏在其下...</description></item><item><title>Go 1.13中值得关注的几个变化</title><link>https://tonybai.com/2019/10/27/some-changes-in-go-1-13/</link><pubDate>Sun, 27 Oct 2019 00:00:00 +0800</pubDate><guid>https://tonybai.com/2019/10/27/some-changes-in-go-1-13/</guid><description>2019年对于Go语言来说也是一个重要的年份，因为在2019年的11月10日，Go即将迎来其开源10周年的纪念日。在这个重要日子的前夕，在GopherCon 2019大会后，Go项目组在2019.9.4日发布了Go 1.13版本。 这是自2017年GopherCon大会上Russ Cox做“Toward Go 2″主题演讲以来Go项目发布的第四个版本（前三个分别是：go 1.10、go 1.11和...</description></item><item><title>记一次go panic问题的解决过程</title><link>https://tonybai.com/2019/04/04/notes-about-fixing-a-go-panic-problem/</link><pubDate>Thu, 04 Apr 2019 00:00:00 +0800</pubDate><guid>https://tonybai.com/2019/04/04/notes-about-fixing-a-go-panic-problem/</guid><description>一. Panic问题概述 ------------ 本周收到客户在bugclose上填写的一个issue：添加一个下发通道后，pushd程序panic并退出了！程序panic时输出的stacktrace信息摘录如下： panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: se...</description></item><item><title>Rancher使用入门</title><link>https://tonybai.com/2016/04/14/an-introduction-about-rancher/</link><pubDate>Thu, 14 Apr 2016 00:00:00 +0800</pubDate><guid>https://tonybai.com/2016/04/14/an-introduction-about-rancher/</guid><description>上个月末，Rancher Labs在其官方博客上宣布了 Rancher 1.0正式版本发布。 这是继Apache Mesos、 Google Kubernetes以及Docker 原生 Swarm 之后，又一个可用于Production环境中的容器管理和服务编排工具，而Rancher恰似这个领域的最后一张拼图（请原谅我的孤陋寡闻，如 果有其他 厂商在做这方面产品，请在评论中留言告诉我）。从Ranc...</description></item><item><title>Go语言是如何处理栈的</title><link>https://tonybai.com/2014/11/05/how-stacks-are-handled-in-go/</link><pubDate>Wed, 05 Nov 2014 00:00:00 +0800</pubDate><guid>https://tonybai.com/2014/11/05/how-stacks-are-handled-in-go/</guid><description>Go 1.4Beta1刚刚发布，在Go 1.4Beta1中，Go语言的stack处理方式由之前的&amp;#34;segmented stacks&amp;#34;改为了&amp;#34;continuous stacks&amp;#34;。关于Go语言对stack的处理机制、发展历史、存在问题等，CloudFlare的一篇官方blog进行了系统的阐述，这里的内容就是 翻译自CloudFlare的那篇blog：《How Stacks are Handled i...</description></item><item><title>当数组访问越界后</title><link>https://tonybai.com/2006/06/16/after-array-index-overflow/</link><pubDate>Fri, 16 Jun 2006 00:00:00 +0800</pubDate><guid>https://tonybai.com/2006/06/16/after-array-index-overflow/</guid><description>下午到ChinaUnix C/C++版看了看，发现一个比较有意思的问题，一位兄弟在其帖子中问一段很简单的程序明显有数组越界访问之错误，可程序为什么运行起来却’安然无恙’，我看看了看，也给出了我自己的回复，晚上下班后又想想了这个问题，决定写一篇blog说说。 这位仁兄的程序(据他个人说来源自’GNU/Linux编程指南’)是这样的： #define BIGNUM 50 void index\_to\...</description></item></channel></rss>