Locks-and-keys

Locks-and-keys

Locks-and-keys is a solution to dangling pointers in computer programming languages.

The locks-and-keys approach represents pointers as ordered pairs (key, address) where the key is an integer value. Heap-dynamic variables are represented as the storage for the variable plus a cell for an integer. When a variable is allocated, a "lock value" is created and placed both into the variable's cell and into the variable's ordered pair. Every access to the pointer compares these two values, and access is allowed only if the values match.

When a variable is deallocated, the key of its ordered pair is modified to hold a value different from the variable's cell. From then on, any attempt to dereference the pointer can be flagged as an error. Since copying a pointer also copies its cell value, changing the key of the ordered pair safely disables all copies of the pointer.

See also

* Tombstone (programming)


Wikimedia Foundation. 2010.

Игры ⚽ Нужно решить контрольную?

Look at other dictionaries:

  • Trinidad and Tobago Carnival — The Trinidad and Tobago Carnival is celebrated two days before Ash Wednesday.Carnival in Trinidad and Tobago is the event of the year. It is said that if the islanders are not celebrating it then they are preparing for it while reminiscing about… …   Wikipedia

  • Monmouthshire and Brecon Canal — The Monmouthshire and Brecon Canal is a small network of canals in South Wales. For most of its 35 mile (56 km) length it runs through the Brecon Beacons National Park, and its present rural character and tranquillity belies its original… …   Wikipedia

  • Nuclear weapons and the United Kingdom — United Kingdom Nuclear program start date 10 April 1940 First nuclear weapon test 2 October 1952 First fusion weapon test …   Wikipedia

  • Separation of mechanism and policy — The Separation of mechanism [Butler W. Lampson and Howard E. Sturgis. [http://research.microsoft.com/Lampson/15 ReflectionsOnOS/Acrobat.pdf Reflections on an Operating System Design] [http://portal.acm.org/citation.cfm?id=360051.360074]… …   Wikipedia

  • Security and safety features new to Windows Vista — There are a number of security and safety features new to Windows Vista, most of which are not available in any prior Microsoft Windows operating system release.Beginning in early 2002 with Microsoft s announcement of their Trustworthy Computing… …   Wikipedia

  • The Door with Seven Locks (1940 film) — The Door with Seven Locks Film poster under American title Directed by Norman Lee Prod …   Wikipedia

  • List of programs and machines in the Matrix series — Below is a list composing of all the artificial characters from The Matrix series of science fiction films, comic books and video games.FilmsThe following characters appear primarily in the Matrix films, but many are also present in the comic… …   Wikipedia

  • Bel Marin Keys, California — Bel Marin Keys is an affluent waterfront community located east of the city of Novato in Marin County, California. The community is an unincorporated area of the county with approximately 700 homes. Most of the homes sit either on one of the many …   Wikipedia

  • Geography and ecology of the Everglades — The geography and ecology of the Everglades involve the complex elements affecting the natural environment throughout the southern region of the U.S. state of Florida. Before drainage, the Everglades were an interwoven mesh of marshes and… …   Wikipedia

  • Legends and the Quran — Part of a series on the Quran …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”