006 · CMU 15-213 — CSAPP Malloc Lab
| 项目 | 内容 |
|---|---|
| 学校 | Carnegie Mellon University |
| 课程 | CMU 15-213 Introduction to Computer Systems (CSAPP) |
| 方向 | 系统 / Systems |
| 语言 | C |
| 难度 | 硬核 / Advanced |
| 预计耗时 | 5–12 天 / 5–12 days |
为什么收录
malloc lab 让系统方向学生直面指针算术、对齐与内存布局——一个 off-by-four 就能让整个程序段错误。这是锻炼底层调试能力的极佳题目。
Malloc lab forces systems students to confront pointer arithmetic, alignment, and memory layout — a single off-by-four segfaults everything.
English: It is also a debugging bootcamp: we hit and fixed three real bugs (out-of-bounds, boundary coalescing, alignment) while building the reference implementation.
实测结果
- gcc 16.2.1 编译通过(-Wall -Wextra 无警告)/ compiles clean
- 3 次 malloc 8 字节对齐、数据隔离;free 后空闲块 1→2→2→1(正确合并)
- 释放后首次适应复用最低地址块(d == a)
- 开发中用 gdb 定位并修复 3 个真实 bug,详见 05-调试与测试.md