scm_t_cell_type_statistics scm_i_master_freelist;
scm_t_cell_type_statistics scm_i_master_freelist2;
-
-
-
/*
In older versions of GUILE GC there was extensive support for
access can be done much more easily by simply checking if the mark bit
is unset before allocation. --hwn
-
-
*/
#if (SCM_ENABLE_DEPRECATED == 1)
#endif /* defined (GUILE_DEBUG) */
#endif /* deprecated */
-
-
-
/* Adjust FREELIST variables to decide wether or not to allocate more heap in
the next GC run based on SWEEP_STATS on SWEEP_STATS_1 (statistics
collected after the two last full GC). */
if (scm_max_segment_size <= 0)
scm_max_segment_size = SCM_DEFAULT_MAX_SEGMENT_SIZE;
-
scm_i_make_initial_segment (init_heap_size_1, &scm_i_master_freelist);
scm_i_make_initial_segment (init_heap_size_2, &scm_i_master_freelist2);
int
scm_i_gc_grow_heap_p (scm_t_cell_type_statistics * freelist)
{
- return SCM_MAX (freelist->collected,freelist->collected_1) < freelist->min_yield;
+ return SCM_MAX (freelist->collected, freelist->collected_1)
+ < freelist->min_yield;
}
#include "libguile/gc.h"
#include "libguile/private-gc.h"
-
-
-
-
size_t scm_max_segment_size;
scm_t_heap_segment *
}
}
-
-
/*
Fill SEGMENT with memory both for data and mark bits.
return tab;
}
-
-
-
/*
Determine whether the given value does actually represent a cell in
some heap segment. If this is the case, the number of the heap
float min_cells = (f * h - sweep_stats.collected) / (1.0 - f);
/* Make heap grow with factor 1.5 */
- len = freelist->heap_size / 2;
+ len = freelist->heap_size / 2;
#ifdef DEBUGINFO
fprintf (stderr, "(%ld < %ld)", (long) len, (long) min_cells);
#endif
-
+
if (len < min_cells)
- len = (unsigned long) min_cells;
+ len = (unsigned long) min_cells;
+
len *= sizeof (scm_t_cell);
/* force new sampling */
freelist->collected = LONG_MAX;
if (len > scm_max_segment_size)
len = scm_max_segment_size;
+
if (len < SCM_MIN_HEAP_SEG_SIZE)
len = SCM_MIN_HEAP_SEG_SIZE;
if (init_heap_size < 1)
{
- init_heap_size = SCM_DEFAULT_INIT_HEAP_SIZE_1;
+ init_heap_size = SCM_DEFAULT_INIT_HEAP_SIZE_1;
}
if (scm_i_initialize_heap_segment_data (seg, init_heap_size))
/*
out of fresh cells. Try to get some new ones.
*/
-
did_gc = 1;
scm_i_gc ("cells");
#define SCM_DEFAULT_MAX_SEGMENT_SIZE (20*1024*1024L)
-
-
#define SCM_MIN_HEAP_SEG_SIZE (8 * SCM_GC_SIZEOF_CARD)
#define SCM_HEAP_SEG_SIZE (16384L * sizeof (scm_t_cell))
-
#define SCM_DOUBLECELL_ALIGNED_P(x) (((2 * sizeof (scm_t_cell) - 1) & SCM_UNPACK (x)) == 0)
A struct holding GC statistics on a particular type of cells.
*/
typedef struct scm_t_cell_type_statistics {
-
/*
heap segment where the last cell was allocated
*/
/*
gc-mark
*/
-
-
void scm_mark_all (void);
-
-
/*
gc-segment:
*/
-
-
-
/*
Cells are stored in a heap-segment: it is a contiguous chunk of
memory, that associated with one freelist.
*/
-
typedef struct scm_t_heap_segment
{
/*
/*
-
A table of segment records is kept that records the upper and
lower extents of the segment; this is used during the conservative
phase of gc to identify probably gc roots (because they point
into valid segments at reasonable offsets).
-
*/
extern scm_t_heap_segment ** scm_i_heap_segment_table;
extern size_t scm_i_heap_segment_table_size;
extern long int scm_i_deprecated_memory_return;
-
/*
global init funcs.
*/