Locks-and-keys (computing)
Locks-and-keys is a solution to dangling pointers in computer programming languages.[src] The locks-and-keys approach represents pointers as ordered pairs (key, address) where the key is an integer value.[src] Heap-dynamic variables are represented as the storage for the variable plus a cell for an integer lock value.[src] When a variable is allocated, a lock value is created and placed both into the variable's cell and into the pointer's key cell.[src] Every access to the pointer compares these two values, and access is allowed only if the values match.[src] When a variable is deallocated, the key of its pointer is modified to hold a value different from the variable's cell.[src] From then on, any attempt to dereference the pointer can be flagged as an error.[src] Since copying a pointer also copies its cell value, changing the key of the ordered pair safely disables all copies of the pointer.[src]
Locks-and-keys is a solution to dangling pointers in computer programming languages.[src] The locks-and-keys approach represents pointers as ordered pairs (key, address) where the key is an integer value.[src] Heap-dynamic variables are represented as the storage for the variable plus a cell for an integer lock value.[src] When a variable is allocated, a lock value is created and placed both into the variable's cell and into the pointer's key cell.[src] Every access to the pointer compares these two values, and access is allowed only if the values match.[src] When a variable is deallocated, the key of its pointer is modified to hold a value different from the variable's cell.[src] From then on, any attempt to dereference the pointer can be flagged as an error.[src] Since copying a pointer also copies its cell value, changing the key of the ordered pair safely disables all copies of the pointer.[src] ==See also== Tombstone (programming) Multiple indirection ==References==[src]
17 sentences · 17 cited inline · 0 references stored
References
No reference rows published for this article.
Cite this article
MLA
"Locks-and-keys (computing)." encyclopegia.org, 2024, https://encyclopegia.org/wiki/locks-and-keys-computing. Accessed 27 November 2026.
Chicago
"Locks-and-keys (computing)." encyclopegia.org. Accessed November 27, 2026. https://encyclopegia.org/wiki/locks-and-keys-computing.
APA
encyclopegia.org. (2024). Locks-and-keys (computing). Retrieved November 27, 2026, from https://encyclopegia.org/wiki/locks-and-keys-computing
Accessed November 27, 2026 · CC BY-SA 4.0 · citation page · JSON