Skip to content

Commit 64240fd

Browse files
committed
Change the default policy to best-fit and space overhead to 100
1 parent 08e635d commit 64240fd

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

runtime/caml/config.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ typedef uint64_t uintnat;
220220
/* Default speed setting for the major GC. The heap will grow until
221221
the dead objects and the free list represent this percentage of the
222222
total size of live objects. */
223-
#define Percent_free_def 80
223+
#define Percent_free_def 100
224224

225225
/* Default setting for the compacter: 500%
226226
(i.e. trigger the compacter when 5/6 of the heap is free or garbage)

runtime/freelist.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1780,20 +1780,20 @@ typedef enum caml_policy_t {
17801780
policy_best_fit = 2,
17811781
} caml_policy_t;
17821782

1783-
uintnat caml_allocation_policy = policy_next_fit;
1783+
uintnat caml_allocation_policy = policy_best_fit;
17841784

17851785
/* These pointers are changed when switching between allocation
17861786
policies. */
1787-
static header_t *(*p_allocate) (mlsize_t wo_sz) = &nf_allocate;
1788-
static void (*p_init_merge) (void) = &nf_init_merge;
1789-
static void (*p_reset) (void) = &nf_reset;
1790-
static header_t *(*p_merge_block) (value bp, char *limit) = &nf_merge_block;
1791-
static void (*p_add_blocks) (value bp) = &nf_add_blocks;
1787+
static header_t *(*p_allocate) (mlsize_t wo_sz) = &bf_allocate;
1788+
static void (*p_init_merge) (void) = &bf_init_merge;
1789+
static void (*p_reset) (void) = &bf_reset;
1790+
static header_t *(*p_merge_block) (value bp, char *limit) = &bf_merge_block;
1791+
static void (*p_add_blocks) (value bp) = &bf_add_blocks;
17921792
static void (*p_make_free_blocks)
17931793
(value *p, mlsize_t size, int do_merge, int color)
1794-
= &nf_make_free_blocks;
1794+
= &bf_make_free_blocks;
17951795
#ifdef DEBUG
1796-
static void (*p_check) (void) = &nf_check;
1796+
static void (*p_check) (void) = &bf_check;
17971797
#endif
17981798

17991799
/********************* exported functions *****************************/

0 commit comments

Comments
 (0)