@@ -212,18 +212,18 @@ CAMLprim value caml_gc_minor(value v)
212212 CAML_EV_BEGIN (EV_EXPLICIT_GC_MINOR );
213213 CAMLassert (v == Val_unit );
214214 caml_minor_collection ();
215+ value exn = caml_process_pending_actions_exn ();
215216 CAML_EV_END (EV_EXPLICIT_GC_MINOR );
216- return Val_unit ;
217+ return caml_raise_if_exception ( exn ) ;
217218}
218219
219220static value gc_major_exn (void )
220221{
221- value exn = Val_unit ;
222222 CAML_EV_BEGIN (EV_EXPLICIT_GC_MAJOR );
223223 caml_gc_log ("Major GC cycle requested" );
224224 caml_empty_minor_heaps_once ();
225225 caml_finish_major_cycle ();
226- exn = caml_process_pending_actions_exn ();
226+ value exn = caml_process_pending_actions_exn ();
227227 CAML_EV_END (EV_EXPLICIT_GC_MAJOR );
228228 return exn ;
229229}
@@ -245,7 +245,7 @@ static value gc_full_major_exn(void)
245245 for (i = 0 ; i < 3 ; i ++ ) {
246246 caml_empty_minor_heaps_once ();
247247 caml_finish_major_cycle ();
248- exn = caml_process_pending_actions_exn ();
248+ exn = caml_process_pending_actions_exn ();
249249 if (Is_exception_result (exn )) break ;
250250 }
251251 ++ Caml_state -> stat_forced_major_collections ;
@@ -264,8 +264,9 @@ CAMLprim value caml_gc_major_slice (value v)
264264 CAML_EV_BEGIN (EV_EXPLICIT_GC_MAJOR_SLICE );
265265 CAMLassert (Is_long (v ));
266266 caml_major_collection_slice (Long_val (v ));
267+ value exn = caml_process_pending_actions_exn ();
267268 CAML_EV_END (EV_EXPLICIT_GC_MAJOR_SLICE );
268- return Val_long ( 0 );
269+ return caml_raise_if_exception ( exn );
269270}
270271
271272CAMLprim value caml_gc_compaction (value v )
0 commit comments