请注意:本页内容发布于 1490 天前,内容可能已经过时,请注意甄别。
原文链接:https://devblogs.microsoft.com/oldnewthing/20051108-05/?p=33423
John Elliott wondered why the GlobalWire function was called GlobalWire.
John Elliott 想知道为什么 GlobalWire 函数起了这么个名字。
First, some background for those who never had to write 16-bit Windows programs. The GlobalWire function was similar to the 16-bit GlobalLock function, except that it had the bonus feature of relocating the memory to the lowest available linear address. You used this function as a courtesy if you intended to leave the memory locked for a long time. Moving it to the edge of the address space means that it is unlikely to become an obstacle in the middle of the address space which would otherwise prevent future large memory allocations from succeeding.
首先,给从来都不需要撰写 16 位 Windows 应用程序的人一点背景资料。GlobalWire 函数与 16 位函数 GlobalLock 类似,不过还有将内存块移动到可用的最低线性地址的附加作用。调用这个函数意味着你想让某部分内存锁定较长的一段时间。将内存块移动到地址空间的边缘,使得这块内存不会成为不上不下地横亘在地址空间的一部分,以期未来的大块内存分配不会失败。
But why “wire”?
不过『wire』这个写法又是怎么回事呢?
This employs a colloquial sense of the word “wire” as a verb which has lost its currency in the intervening years. To wire means to fasten securely in a very strong sense. It probably derives from the phrase “hard-wired”, which means “permanently attached in circuitry”. Therefore, “wiring” memory into place ensures that it doesn’t move around.
这里是借用了 wire 这个词作为动词的口语说法,而这种用法这些年大概逐渐式微了。『To wire』意味着将某物『紧紧绑住』的一种强烈语气,可能是来自短语『hard-wired』,含义是『在电路中永久固定』。由此,将内存『捆绑』在某处就是期望其不会到处乱跑。
远嚣 Comment