From 08932bfd6d395d4c45fc3e7426d248ee69cef8aa Mon Sep 17 00:00:00 2001 From: Simon Brooke Date: Sun, 17 Sep 2017 16:37:07 +0100 Subject: [PATCH] Updated memory management (markdown) --- memory-management.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/memory-management.md b/memory-management.md index d84d552..ca90a26 100644 --- a/memory-management.md +++ b/memory-management.md @@ -27,7 +27,7 @@ So my first observation is that [[cons space]] and what I call [[vector space]] ### Lockin from reference count overflow -Older reference counting Lisps tended to allocate very few bits for the reference count. Typically a cons cell was allocated in 32 bits, with two twelve bit pointers, leaving a total of eight bits for the tag bits and the reference counter bits. So you had reference counters with only eight or sixteen possible values. When a reference counter hits the top value which can be stored in its field, you cannot ever decrement it. So any cell which ended up with that number of other cells pointing to it, even if only very temporarily, got locked into memory and couldn't be garbage collected. +Older reference counting Lisps tended to allocate very few bits for the reference count. Typically a cons cell was allocated in 32 bits, with two twelve bit pointers, leaving a total of eight bits for the tag bits and the reference counter bits. So you had reference counters with only eight or sixteen possible values. When a reference counter hits the top value which can be stored in its field, it cannot be further incremented. So you cannot ever decrement it, because you don't know whether it represents `max-value` or, e.g., `max-value + 21`. So any cell which ended up with that number of other cells pointing to it, even if only very temporarily, got locked into memory and couldn't be garbage collected. But modern computers have vastly more memory than the computers on which those Lisps ran. My desktop machine now has more than 16,000 times as much memory as my very expensive workstation of only thirty years ago. We can afford much bigger reference counter fields. So the risk of hitting the maximum reference count value is much lower.