错误代码 ERROR_ARENA_TRASHED 的历史是什么?
What is the history of the ERROR_ARENA_TRASHED error code?

原始链接: https://devblogs.microsoft.com/oldnewthing/20260519-00/?p=112339

错误代码 7,即 `ERROR_ARENA_TRASHED`,是一个早期的 MS-DOS 错误,表示内存损坏。在 MS-DOS 中,系统通过带有前缀“arena”的块来管理内存,这些块使用特定的签名——即开发人员 Mark Zbikowski 的姓名首字母 'M' (0x4D) 和 'Z' (0x5A)——来追踪内存分配。如果系统遇到这些签名以外的内容,就会判定内存已“损坏”(trashed)。 在现代 Win32 环境中,该错误已过时,尽管它偶尔会出现在某些特定的用户模式组件中,用以指示内部结构损坏。由于它本质上属于残留物,开发人员常将其作为一种实用的诊断工具,用于在测试环境中模拟错误,且不会与实际的系统问题产生冲突。 值得注意的是,许多网站提供了针对此错误的通用“修复方法”,例如运行系统扫描或更新驱动程序。这些说法具有误导性;由于该错误在现代操作系统中并非标准系统级问题,因此这些“修复指南”往往是基于猜测,而非技术事实。

``` Hacker News 最新 | 过往 | 评论 | 提问 | 展示 | 招聘 | 提交 登录 ERROR_ARENA_TRASHED 错误代码的历史是什么? (devblogs.microsoft.com/oldnewthing) 5 分,由 supermatou 发布于 1 小时前 | 隐藏 | 过往 | 收藏 | 讨论 帮助 指南 | 常见问题 | 列表 | API | 安全 | 法律 | 申请 YC | 联系 搜索: ```
相关文章

原文

Error code 7 is ERROR_ARENA_TRASHED. What does this mean? It sounds like a heavy metal band ran amok and made a mess of the performance area that they rented.

This error message was inherited from MS-DOS. MS-DOS internally kept track of memory in the form of a sequence of variable-sized memory blocks, each prefixed by a 16-byte block known as an arena:

arena   STRUC
arena_signature     DB  ?               ; 4D for valid item, 5A for last item
arena_owner         DW  ?               ; owner of arena item
arena_size          DW  ?               ; size in paragraphs of item
arena   ENDS

The arena_owner is the PDB of the process that allocated the memory, or zero if the memory is free. Each arena signature is 0x4D (ASCII capital M), except for the final one which is 0x5A (ASCII capital Z). Yes, those are the initials of Mark Zbikowski.

When walking through the memory blocks, say, when searching for memory to satisfy an allocation request, if MS-DOS saw that the signature was neither 0x4D nor 0x5A, then it declared that the arenas were “trashed” (corrupted)¹ and returned ERROR_ARENA_TRASHED.

This is an MS-DOS specific error code. It is not used by Win32.²

Since it is a vestigial error code (like EMPTY_THREAD_REAPER_LIST), it is a handy error code to use when mocking error conditions, because you can be fairly confident that if you see error 7, it came from your test harness and not from a genuine system error.

The fact that the error message is not used casts suspicions on the many web sites that claim to be able to help you “fix” the problem. If you read their explanation of “what this error means”, it’s just a bunch of vague text about how, y’know, sometimes computers aren’t doing all that great and they encounter errors, or maybe there is a hardware conflict, or a corrupted system file. But somehow, despite having no idea what the error means, they still are quite confident in the steps you should take to fix it. (Usually performing a system scan, a system file check, and checking for driver updates.)

¹ The use of the slang term “trashed” is further evidence that Microsoft developers were just a bunch of undisciplined hackers.

² Well, at least, it is not used by the Win32 kernel. I do see that there are a few user-mode components which use it to indicate that internal data structures have been corrupted, which is at least in the same spirit as the original meaning of the error.

联系我们 contact @ memedata.com