<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>第四篇 内存与并发 on 编程那些事儿</title><link>https://before80.github.io/prgms/Swift/basic/Part-4-Memory-and-Concurrency/</link><description>Recent content in 第四篇 内存与并发 on 编程那些事儿</description><generator>Hugo</generator><language>zh-cn</language><lastBuildDate>Sat, 19 Sep 2026 21:54:25 +0800</lastBuildDate><atom:link href="https://before80.github.io/prgms/Swift/basic/Part-4-Memory-and-Concurrency/index.xml" rel="self" type="application/rss+xml"/><item><title>第27章 值语义、写时复制与 ARC</title><link>https://before80.github.io/prgms/Swift/basic/Part-4-Memory-and-Concurrency/Chapter-27-Value-Semantics-COW-and-ARC/</link><pubDate>Mon, 14 Sep 2026 22:30:00 +0800</pubDate><guid>https://before80.github.io/prgms/Swift/basic/Part-4-Memory-and-Concurrency/Chapter-27-Value-Semantics-COW-and-ARC/</guid><description>&lt;h1 id="第二十七章值语义写时复制与-arc"&gt;第二十七章：值语义、写时复制与 ARC&lt;/h1&gt;
&lt;blockquote&gt;
&lt;p&gt;结构体复制起来为什么没有把数组里的几百万个元素全抄一遍？类实例释放时，Swift 又是怎么知道该调用 &lt;code&gt;deinit&lt;/code&gt;？答案分别在写时复制（COW）和自动引用计数（ARC）里。它们不是语法糖，而是 Swift 性能与内存模型的地基。&lt;/p&gt;</description></item><item><title>第28章 循环引用：weak、unowned 与闭包捕获</title><link>https://before80.github.io/prgms/Swift/basic/Part-4-Memory-and-Concurrency/Chapter-28-Reference-Cycles/</link><pubDate>Mon, 14 Sep 2026 22:30:00 +0800</pubDate><guid>https://before80.github.io/prgms/Swift/basic/Part-4-Memory-and-Concurrency/Chapter-28-Reference-Cycles/</guid><description>&lt;h1 id="第二十八章循环引用weakunowned-与闭包捕获"&gt;第二十八章：循环引用：&lt;code&gt;weak&lt;/code&gt;、&lt;code&gt;unowned&lt;/code&gt; 与闭包捕获&lt;/h1&gt;
&lt;blockquote&gt;
&lt;p&gt;两个对象互相拉着对方的手，谁都不肯先走，内存就会一直涨。这不是玄学，而是 ARC 的必然结果。解决循环引用的工具只有几个，但每个都有明确的使用条件，弄清楚之后再也不会“看到 self 就加 weak”。&lt;/p&gt;</description></item><item><title>第29章 内存安全与所有权：borrowing、consuming 与不可复制类型</title><link>https://before80.github.io/prgms/Swift/basic/Part-4-Memory-and-Concurrency/Chapter-29-Memory-Safety-and-Ownership/</link><pubDate>Mon, 14 Sep 2026 22:30:00 +0800</pubDate><guid>https://before80.github.io/prgms/Swift/basic/Part-4-Memory-and-Concurrency/Chapter-29-Memory-Safety-and-Ownership/</guid><description>&lt;h1 id="第二十九章内存安全与所有权borrowingconsuming-与不可复制类型"&gt;第二十九章：内存安全与所有权：&lt;code&gt;borrowing&lt;/code&gt;、&lt;code&gt;consuming&lt;/code&gt; 与不可复制类型&lt;/h1&gt;
&lt;blockquote&gt;
&lt;p&gt;Swift 的内存安全不只靠 ARC，还靠独占访问和所有权规则。到了最新 Swift，类型可以明确表示“只能借出去”“可以被消费掉”“根本不能复制”。这些能力让高性能代码不必在安全和效率之间二选一。&lt;/p&gt;</description></item><item><title>第30章 并发（一）：async/await、Task 与结构化并发</title><link>https://before80.github.io/prgms/Swift/basic/Part-4-Memory-and-Concurrency/Chapter-30-Concurrency-Part-1/</link><pubDate>Mon, 14 Sep 2026 22:30:00 +0800</pubDate><guid>https://before80.github.io/prgms/Swift/basic/Part-4-Memory-and-Concurrency/Chapter-30-Concurrency-Part-1/</guid><description>&lt;h1 id="第三十章并发一asyncawaittask-与结构化并发"&gt;第三十章：并发（一）：&lt;code&gt;async/await&lt;/code&gt;、&lt;code&gt;Task&lt;/code&gt; 与结构化并发&lt;/h1&gt;
&lt;blockquote&gt;
&lt;p&gt;异步不是“多开几个线程”这么简单，而是让程序在等待网络、磁盘或计时器时，能去做别的事。Swift 用 &lt;code&gt;async/await&lt;/code&gt; 把这种等待写进代码结构，又用结构化并发保证子任务不会像断线风筝一样失控。&lt;/p&gt;</description></item><item><title>第31章 并发（二）：隔离域、actor 与 Sendable</title><link>https://before80.github.io/prgms/Swift/basic/Part-4-Memory-and-Concurrency/Chapter-31-Concurrency-Part-2/</link><pubDate>Mon, 14 Sep 2026 22:30:00 +0800</pubDate><guid>https://before80.github.io/prgms/Swift/basic/Part-4-Memory-and-Concurrency/Chapter-31-Concurrency-Part-2/</guid><description>&lt;h1 id="第三十一章并发二隔离域actor-与-sendable"&gt;第三十一章：并发（二）：隔离域、&lt;code&gt;actor&lt;/code&gt; 与 &lt;code&gt;Sendable&lt;/code&gt;&lt;/h1&gt;
&lt;blockquote&gt;
&lt;p&gt;并发真正困难的部分不是“同时跑”，而是“同时改”。多个任务一起修改同一份状态，结果可能比抽奖还不透明。Swift 用隔离域把可变状态关进单行道，用 &lt;code&gt;actor&lt;/code&gt; 和 &lt;code&gt;Sendable&lt;/code&gt; 在编译期抓住大多数数据竞争。&lt;/p&gt;</description></item><item><title>第32章 并发（三）：Approachable Concurrency 与迁移</title><link>https://before80.github.io/prgms/Swift/basic/Part-4-Memory-and-Concurrency/Chapter-32-Concurrency-Part-3/</link><pubDate>Mon, 14 Sep 2026 22:30:00 +0800</pubDate><guid>https://before80.github.io/prgms/Swift/basic/Part-4-Memory-and-Concurrency/Chapter-32-Concurrency-Part-3/</guid><description>&lt;h1 id="第三十二章并发三approachable-concurrency-与迁移"&gt;第三十二章：并发（三）：Approachable Concurrency 与迁移&lt;/h1&gt;
&lt;blockquote&gt;
&lt;p&gt;并发安全最难的不是新项目，而是把已有代码从“能跑”搬到“编译器能证明安全”。Swift 6 提供了严格检查，也提供了 Approachable Concurrency 这套更顺手的默认规则。迁移的关键不是一次性改完，而是让边界逐步清楚。&lt;/p&gt;</description></item></channel></rss>