Why was GlobalWire called GlobalWire?

John Elliott wondered why the GlobalWire function was called 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.

But why "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.

Comments (10)
  1. Gabe says:

    I believe that in modern VM parlance this would be called "pinning". One "pins" memory to prevent it from being paged out or GC’d.

  2. bramster says:

    "But why "wire"?"

    In applications where a nut-and-bolt fastening system must not vibrate loose, the nut used is a "castlelated" nut, the bolt has a hole through it. After tightening the nut, a "safety-wire" is run through the hole, and twisted into place. There are special "safety-wire" pliers, which make the twisting of the wire very quick.

  3. Scott says:

    Thoughts of old core memory leap to mind…

  4. K.T. says:

    "GlobalWire"??? – Sounds more like a financial transaction!

    Is this a prime example of why APIs should be vetted for colloquialisms?

    Are there any win32 functions that have esoteric names?

  5. John Elliott says:

    Wow. That was almost same-year service :-)

    Gabe: I don’t think this is quite the same as pinning, because that would be done with GlobalLock. Or maybe GlobalFix. Oddly enough, there isn’t a GlobalPin or GlobalGlue or GlobalWeld…

  6. Art says:

    I like PrestoChangoSelector() more.

  7. Daev says:

    A function with the same intent as GlobalWire might still be useful.

    Suppose your program is used for number crunching on potentially very large matrices. You might need to grab several BIG chunks of memory from the allocator.

    If you could ensure that your program’s modules (application, DLLs, etc.) hugged the fringes of virtual memory address space, that would leave lots of free empty room in the middle.

    Wide open stretches of contiguous unallocated memory could mean the difference between success and failure when you call malloc(REALLY_BIG_NUMBER).

  8. Mike Dunn says:

    Daev> The system DLLs are already mapped at the top end of the lower 2GB of the address space. As for your own allocs, VirtualAlloc() lets you specify the virtual address in the address space, so if you know you’re going to have large allocs, you can do them in the middle of the 2GB range.

    Or, you can use the techniques that Raymond posted about a while ago (in the series about misconceptions regarding memory and address space) if you need to manually swap data in/out of your address space.

  9. James Risto says:

    GlobalWire and PrestoChangoSelector are still more meaningful than the BurgerMaster segment!

  10. mschaef says:

    "GlobalWire and PrestoChangoSelector are still more meaningful than the BurgerMaster segment! "

    Not if you’re hungry after working long hours on the memory manager. :-)

Comments are closed.

Skip to main content