mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-11 06:20:23 +02:00
* gc.c (adjust_gc_trigger): Improved documentation.
(alloc_some_heap): Since gc_trigger is used against freelist->collected, this is the value which should be used to predict minimum growth.
This commit is contained in:
parent
b464b97039
commit
bda1446cd5
1 changed files with 13 additions and 8 deletions
|
@ -782,13 +782,16 @@ SCM_DEFINE (scm_gc, "gc", 0, 0, 0,
|
||||||
static void
|
static void
|
||||||
adjust_gc_trigger (scm_freelist_t *freelist)
|
adjust_gc_trigger (scm_freelist_t *freelist)
|
||||||
{
|
{
|
||||||
/* GC trigger is adjusted upwards so that next predicted yield is
|
/* GC trigger is adjusted upwards so that next predicted total yield
|
||||||
* gc_trigger_fraction of total heap size.
|
* (allocated cells actually freed by GC) becomes
|
||||||
|
* `gc_trigger_fraction' of total heap size. Note, however, that
|
||||||
|
* the absolute value of gc_trigger will correspond to `collected'
|
||||||
|
* on one master (the one which currently is triggering GC).
|
||||||
*
|
*
|
||||||
* The reason why we look at actual yield instead of collected cells
|
* The reason why we look at total yield instead of cells collected
|
||||||
* is that we want to take other freelists into account. On this
|
* on one list is that we want to take other freelists into account.
|
||||||
* freelist, we know that yield = collected cells, but that's
|
* On this freelist, we know that (local) yield = collected cells,
|
||||||
* probably not the case on the other lists.
|
* but that's probably not the case on the other lists.
|
||||||
*
|
*
|
||||||
* (We might consider computing a better prediction, for example
|
* (We might consider computing a better prediction, for example
|
||||||
* by computing an average over multiple GC:s.)
|
* by computing an average over multiple GC:s.)
|
||||||
|
@ -2309,8 +2312,10 @@ alloc_some_heap (scm_freelist_t *freelist)
|
||||||
*/
|
*/
|
||||||
#ifdef GUILE_NEW_GC_SCHEME
|
#ifdef GUILE_NEW_GC_SCHEME
|
||||||
{
|
{
|
||||||
/* Assure that the new segment is large enough for the new trigger */
|
/* Assure that the new segment is predicted to be large enough for
|
||||||
int slack = freelist->gc_trigger - scm_gc_yield;
|
* the new trigger.
|
||||||
|
*/
|
||||||
|
int slack = freelist->gc_trigger - freelist->collected;
|
||||||
int min_cells = 100 * slack / (99 - freelist->gc_trigger_fraction);
|
int min_cells = 100 * slack / (99 - freelist->gc_trigger_fraction);
|
||||||
len = SCM_EXPHEAP (freelist->heap_size);
|
len = SCM_EXPHEAP (freelist->heap_size);
|
||||||
#ifdef DEBUGINFO
|
#ifdef DEBUGINFO
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue