diff options
| author | Damien Doligez <damien.doligez-inria.fr> | 2005-03-24 17:20:54 +0000 |
|---|---|---|
| committer | Damien Doligez <damien.doligez-inria.fr> | 2005-03-24 17:20:54 +0000 |
| commit | e6007f6057d1d4e68a5618f232953344b683a168 (patch) | |
| tree | ee5baa59e5eb0ebc4354bd215bd3c682986bf632 /byterun/gc_ctrl.c | |
| parent | 958bd6c49292afa23e5fee51770c45d1f8499faa (diff) | |
| download | ocaml-e6007f6057d1d4e68a5618f232953344b683a168.tar.gz | |
fusion des changements jusqu'a 3.08.3
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@6824 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'byterun/gc_ctrl.c')
| -rw-r--r-- | byterun/gc_ctrl.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/byterun/gc_ctrl.c b/byterun/gc_ctrl.c index 8d5f8036e0..ed4bc3de38 100644 --- a/byterun/gc_ctrl.c +++ b/byterun/gc_ctrl.c @@ -392,21 +392,40 @@ CAMLprim value caml_gc_minor(value v) return Val_unit; } +static void test_and_compact (void) +{ + float fp; + + fp = 100.0 * caml_fl_cur_size + / (Wsize_bsize (caml_stat_heap_size) - caml_fl_cur_size); + if (fp > 1000000.0) fp = 1000000.0; + caml_gc_message (0x200, "Estimated overhead (lower bound) = %lu%%\n", + (unsigned long) fp); + if (fp >= caml_percent_max && caml_stat_heap_chunks > 1){ + caml_gc_message (0x200, "Automatic compaction triggered.\n", 0); + caml_compact_heap (); + } +} + CAMLprim value caml_gc_major(value v) { Assert (v == Val_unit); + caml_gc_message (0x1, "Major GC cycle requested\n", 0); caml_empty_minor_heap (); caml_finish_major_cycle (); + test_and_compact (); caml_final_do_calls (); return Val_unit; } CAMLprim value caml_gc_full_major(value v) { Assert (v == Val_unit); + caml_gc_message (0x1, "Full major GC cycle requested\n", 0); caml_empty_minor_heap (); caml_finish_major_cycle (); caml_final_do_calls (); caml_empty_minor_heap (); caml_finish_major_cycle (); + test_and_compact (); caml_final_do_calls (); return Val_unit; } |
