- Handle (computing)
A handle is a particular kind of
smart pointer . Handles are used when an application references blocks of memory or objects managed by another system, such as adatabase or anoperating system . While a pointer literally contains the address of the item to which it refers, a handle is an abstract reference controlled by a separate system; its opacity allows the referent to be relocated in memory by the system without invalidating the handle — impossible with pointers. The extra layer ofindirection also increases the control the managing system has over operations performed on the referent (seeinformation hiding ,encapsulation ). Handles were a popular solution tomemory management in operating systems of the 1980s, such asMac OS and Windows.Unix file descriptor s are essentially handles. Like other desktop environments, theWindows API heavily uses handles to represent objects in the system and to provide a communication pathway between the operating system anduser space . For example, a window on the desktop is represented by a handle of typeHWND
. Traditional, doubly-indirect handles have fallen out of favour in recent times, as increases in available memory and improvedvirtual memory algorithms have made the use of the simpler pointer more attractive. However, many operating systems still apply the term to pointers to opaque, "private" data structures, or indexes into internal arrays passed from one process to its clients.
Wikimedia Foundation. 2010.