mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-29 16:30:19 +02:00
(scm_i_get_new_heap_segment): use float in stead of
unsigned numbers for computing minimum heap increment. This prevents weird results when a a negative minimum increment is computed.
This commit is contained in:
parent
e99730fcc5
commit
38d1262ab5
2 changed files with 12 additions and 16 deletions
|
@ -1,3 +1,10 @@
|
||||||
|
2002-08-25 Han-Wen Nienhuys <hanwen@cs.uu.nl>
|
||||||
|
|
||||||
|
* gc-segment.c (scm_i_get_new_heap_segment): use float in stead of
|
||||||
|
unsigned numbers for computing minimum heap increment. This
|
||||||
|
prevents weird results when a a negative minimum increment is
|
||||||
|
computed.
|
||||||
|
|
||||||
2002-08-24 Marius Vollmer <mvo@zagadka.ping.de>
|
2002-08-24 Marius Vollmer <mvo@zagadka.ping.de>
|
||||||
|
|
||||||
* gc_os_dep.c: When we have __libc_stack_end, use that directly
|
* gc_os_dep.c: When we have __libc_stack_end, use that directly
|
||||||
|
|
|
@ -469,11 +469,6 @@ scm_i_get_new_heap_segment (scm_t_cell_type_statistics *freelist, policy_on_erro
|
||||||
abort ();
|
abort ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Pick a size for the new heap segment.
|
|
||||||
* The rule for picking the size of a segment is explained in
|
|
||||||
* gc.h
|
|
||||||
*/
|
|
||||||
{
|
{
|
||||||
/* Assure that the new segment is predicted to be large enough.
|
/* Assure that the new segment is predicted to be large enough.
|
||||||
*
|
*
|
||||||
|
@ -488,13 +483,10 @@ scm_i_get_new_heap_segment (scm_t_cell_type_statistics *freelist, policy_on_erro
|
||||||
*
|
*
|
||||||
* This gives dh > (f * h - y) / (1 - f)
|
* This gives dh > (f * h - y) / (1 - f)
|
||||||
*/
|
*/
|
||||||
|
float f = freelist->min_yield_fraction / 100.0;
|
||||||
/*
|
float h = SCM_HEAP_SIZE;
|
||||||
where is is this explanation supposed to be? --hwn
|
float min_cells
|
||||||
*/
|
= (f * h - scm_gc_cells_collected) / (1.0 - f);
|
||||||
int f = freelist->min_yield_fraction;
|
|
||||||
unsigned long h = SCM_HEAP_SIZE;
|
|
||||||
size_t min_cells = (f * h - 100 * (long) scm_gc_cells_collected) / (99 - f);
|
|
||||||
|
|
||||||
/* Make heap grow with factor 1.5 */
|
/* Make heap grow with factor 1.5 */
|
||||||
len = freelist->heap_size / 2;
|
len = freelist->heap_size / 2;
|
||||||
|
@ -502,11 +494,8 @@ scm_i_get_new_heap_segment (scm_t_cell_type_statistics *freelist, policy_on_erro
|
||||||
fprintf (stderr, "(%ld < %ld)", (long) len, (long) min_cells);
|
fprintf (stderr, "(%ld < %ld)", (long) len, (long) min_cells);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
|
||||||
Original code adds freelist->cluster_size here.
|
|
||||||
*/
|
|
||||||
if (len < min_cells)
|
if (len < min_cells)
|
||||||
len = min_cells;
|
len = (unsigned long) min_cells;
|
||||||
len *= sizeof (scm_t_cell);
|
len *= sizeof (scm_t_cell);
|
||||||
/* force new sampling */
|
/* force new sampling */
|
||||||
freelist->collected = LONG_MAX;
|
freelist->collected = LONG_MAX;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue