+2009-09-19 Ivan Maidanski <ivmai@mail.ru>
+ (ivmai149.diff)
+
+ * dbg_mlc.c (GC_generate_random_backtrace): Call
+ GC_try_to_collect(GC_never_stop_func) instead of GC_gcollect();
+ if GC is disabled then print error message and return.
+ * include/gc.h (GC_try_to_collect): Refine the comment.
+ * include/private/gc_priv.h (GC_never_stop_func): Fix return type;
+ refine the comment.
+
2009-09-19 Ivan Maidanski <ivmai@mail.ru>
(ivmai147.diff)
GC_API void GC_CALL GC_generate_random_backtrace(void)
{
- GC_gcollect();
+ if (GC_try_to_collect(GC_never_stop_func) == 0) {
+ GC_err_printf("Cannot generate a backtrace: "
+ "garbage collection is disabled!\n");
+ return;
+ }
GC_generate_random_backtrace_no_gc();
}
/* than normal pause times for incremental collection. However, */
/* aborted collections do no useful work; the next collection needs */
/* to start from the beginning. stop_func must not be 0. */
-/* Return 0 if the collection was aborted, 1 if it succeeded. */
+/* GC_try_to_collect() returns 0 if the collection was aborted (or the */
+/* collections are disabled), 1 if it succeeded. */
typedef int (GC_CALLBACK * GC_stop_func)(void);
GC_API int GC_CALL GC_try_to_collect(GC_stop_func /* stop_func */);
/* reclaimed bytes to *count. */
GC_bool GC_block_empty(hdr * hhdr);
/* Block completely unmarked? */
-GC_bool GC_CALLBACK GC_never_stop_func(void);
- /* Returns FALSE. */
+int GC_CALLBACK GC_never_stop_func(void);
+ /* Always returns 0 (FALSE). */
GC_bool GC_try_to_collect_inner(GC_stop_func f);
/* Collect; caller must have acquired */