diff options
| author | Paul Eggert | 2019-09-14 10:53:24 -0700 |
|---|---|---|
| committer | Paul Eggert | 2019-09-14 10:56:12 -0700 |
| commit | 1acc0cc9aaf25c808a60cf09cf8a4d1c653c3aa9 (patch) | |
| tree | a1b386031ae203e49564cccc6071e564fe5f0348 | |
| parent | 3f43adac495364aa76703acb86b07b47fe64b422 (diff) | |
| download | emacs-1acc0cc9aaf25c808a60cf09cf8a4d1c653c3aa9.tar.gz emacs-1acc0cc9aaf25c808a60cf09cf8a4d1c653c3aa9.zip | |
Improve doc of GC thresholds
* doc/lispref/internals.texi (Garbage Collection), etc/NEWS:
Warn that control over GC is only approximate.
| -rw-r--r-- | doc/lispref/internals.texi | 13 | ||||
| -rw-r--r-- | etc/NEWS | 7 |
2 files changed, 17 insertions, 3 deletions
diff --git a/doc/lispref/internals.texi b/doc/lispref/internals.texi index f85c266edef..c52999e1cd2 100644 --- a/doc/lispref/internals.texi +++ b/doc/lispref/internals.texi | |||
| @@ -533,9 +533,6 @@ be allocated for Lisp objects after one garbage collection in order to | |||
| 533 | trigger another garbage collection. You can use the result returned by | 533 | trigger another garbage collection. You can use the result returned by |
| 534 | @code{garbage-collect} to get an information about size of the particular | 534 | @code{garbage-collect} to get an information about size of the particular |
| 535 | object type; space allocated to the contents of buffers does not count. | 535 | object type; space allocated to the contents of buffers does not count. |
| 536 | Note that the subsequent garbage collection does not happen immediately | ||
| 537 | when the threshold is exhausted, but only the next time the Lisp interpreter | ||
| 538 | is called. | ||
| 539 | 536 | ||
| 540 | The initial threshold value is @code{GC_DEFAULT_THRESHOLD}, defined in | 537 | The initial threshold value is @code{GC_DEFAULT_THRESHOLD}, defined in |
| 541 | @file{alloc.c}. Since it's defined in @code{word_size} units, the value | 538 | @file{alloc.c}. Since it's defined in @code{word_size} units, the value |
| @@ -562,6 +559,16 @@ increases. Thus, it can be desirable to do them less frequently in | |||
| 562 | proportion. | 559 | proportion. |
| 563 | @end defopt | 560 | @end defopt |
| 564 | 561 | ||
| 562 | Control over the garbage collector via @code{gc-cons-threshold} and | ||
| 563 | @code{gc-cons-percentage} is only approximate. Although Emacs checks | ||
| 564 | for threshold exhaustion regularly, for efficiency reasons it does not | ||
| 565 | do so immediately after every change to the heap or to | ||
| 566 | @code{gc-cons-threshold} or @code{gc-cons-percentage}, so exhausting | ||
| 567 | the threshold does not immediately trigger garbage collection. Also, | ||
| 568 | for efficency in threshold calculations Emacs approximates the heap | ||
| 569 | size, which counts the bytes used by currently-accessible objects in | ||
| 570 | the heap. | ||
| 571 | |||
| 565 | The value returned by @code{garbage-collect} describes the amount of | 572 | The value returned by @code{garbage-collect} describes the amount of |
| 566 | memory used by Lisp data, broken down by data type. By contrast, the | 573 | memory used by Lisp data, broken down by data type. By contrast, the |
| 567 | function @code{memory-limit} provides information on the total amount of | 574 | function @code{memory-limit} provides information on the total amount of |
| @@ -2430,6 +2430,13 @@ remote systems, which support this check. | |||
| 2430 | ** 'memory-limit' now returns a better estimate of memory consumption. | 2430 | ** 'memory-limit' now returns a better estimate of memory consumption. |
| 2431 | 2431 | ||
| 2432 | +++ | 2432 | +++ |
| 2433 | ** When interpreting 'gc-cons-percentage', Emacs now estimates the | ||
| 2434 | heap size more often and (we hope) more accurately. E.g., formerly | ||
| 2435 | (progn (let ((gc-cons-percentage 0.8)) BODY1) BODY2) continued to use | ||
| 2436 | the 0.8 value during BODY2 until the next garbage collection, but that | ||
| 2437 | is no longer true. Applications may need to re-tune their GC tricks. | ||
| 2438 | |||
| 2439 | +++ | ||
| 2433 | ** New macro 'combine-change-calls' arranges to call the change hooks | 2440 | ** New macro 'combine-change-calls' arranges to call the change hooks |
| 2434 | ('before-change-functions' and 'after-change-functions') just once | 2441 | ('before-change-functions' and 'after-change-functions') just once |
| 2435 | each around a sequence of lisp forms, given a region. This is | 2442 | each around a sequence of lisp forms, given a region. This is |