diff options
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/lispref/ChangeLog | 5 | ||||
| -rw-r--r-- | doc/lispref/internals.texi | 29 |
2 files changed, 28 insertions, 6 deletions
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog index b774809feb9..1ef5595fa06 100644 --- a/doc/lispref/ChangeLog +++ b/doc/lispref/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2012-06-08 Dmitry Antipov <dmantipov@yandex.ru> | ||
| 2 | |||
| 3 | * internals.text (Garbage Collection): Document new | ||
| 4 | vector management code and vectorlike_header structure. | ||
| 5 | |||
| 1 | 2012-06-03 Chong Yidong <cyd@gnu.org> | 6 | 2012-06-03 Chong Yidong <cyd@gnu.org> |
| 2 | 7 | ||
| 3 | * modes.texi (Mode Line Data): Use "mode line construct" | 8 | * modes.texi (Mode Line Data): Use "mode line construct" |
diff --git a/doc/lispref/internals.texi b/doc/lispref/internals.texi index 5d4a9c6a3af..1d0a7102a22 100644 --- a/doc/lispref/internals.texi +++ b/doc/lispref/internals.texi | |||
| @@ -215,10 +215,23 @@ You should not change this flag in a running Emacs. | |||
| 215 | (such as by loading a library), that data is placed in normal storage. | 215 | (such as by loading a library), that data is placed in normal storage. |
| 216 | If normal storage runs low, then Emacs asks the operating system to | 216 | If normal storage runs low, then Emacs asks the operating system to |
| 217 | allocate more memory. Different types of Lisp objects, such as | 217 | allocate more memory. Different types of Lisp objects, such as |
| 218 | symbols, cons cells, markers, etc., are segregated in distinct blocks | 218 | symbols, cons cells, small vectors, markers, etc., are segregated in |
| 219 | in memory. (Vectors, long strings, buffers and certain other editing | 219 | distinct blocks in memory. (Large vectors, long strings, buffers and |
| 220 | types, which are fairly large, are allocated in individual blocks, one | 220 | certain other editing types, which are fairly large, are allocated in |
| 221 | per object, while small strings are packed into blocks of 8k bytes.) | 221 | individual blocks, one per object; small strings are packed into blocks |
| 222 | of 8k bytes, and small vectors are packed into blocks of 4k bytes). | ||
| 223 | |||
| 224 | @cindex vector-like objects, storage | ||
| 225 | @cindex storage of vector-like Lisp objects | ||
| 226 | Beyond the basic vector, a lot of objects like window, buffer, and | ||
| 227 | frame are managed as if they were vectors. The corresponding C data | ||
| 228 | structures include the @code{struct vectorlike_header} field whose | ||
| 229 | @code{next} field points to the next object in the chain: | ||
| 230 | @code{header.next.buffer} points to the next buffer (which could be | ||
| 231 | a killed buffer), and @code{header.next.vector} points to the next | ||
| 232 | vector in a free list. If a vector is small (smaller than or equal to | ||
| 233 | @code{VBLOCK_BYTES_MIN} bytes, see @file{alloc.c}), then | ||
| 234 | @code{header.next.nbytes} contains the vector size in bytes. | ||
| 222 | 235 | ||
| 223 | @cindex garbage collection | 236 | @cindex garbage collection |
| 224 | It is quite common to use some storage for a while, then release it | 237 | It is quite common to use some storage for a while, then release it |
| @@ -243,8 +256,12 @@ might as well be reused, since no one will miss them. The second | |||
| 243 | The sweep phase puts unused cons cells onto a @dfn{free list} | 256 | The sweep phase puts unused cons cells onto a @dfn{free list} |
| 244 | for future allocation; likewise for symbols and markers. It compacts | 257 | for future allocation; likewise for symbols and markers. It compacts |
| 245 | the accessible strings so they occupy fewer 8k blocks; then it frees the | 258 | the accessible strings so they occupy fewer 8k blocks; then it frees the |
| 246 | other 8k blocks. Vectors, buffers, windows, and other large objects are | 259 | other 8k blocks. Unreachable vectors from vector blocks are coalesced |
| 247 | individually allocated and freed using @code{malloc} and @code{free}. | 260 | to create largest possible free areas; if a free area spans a complete |
| 261 | 4k block, that block is freed. Otherwise, the free area is recorded | ||
| 262 | in a free list array, where each entry corresponds to a free list | ||
| 263 | of areas of the same size. Large vectors, buffers, and other large | ||
| 264 | objects are allocated and freed individually. | ||
| 248 | 265 | ||
| 249 | @cindex CL note---allocate more storage | 266 | @cindex CL note---allocate more storage |
| 250 | @quotation | 267 | @quotation |