]> granicus.if.org Git - gc/commitdiff
2009-09-19 Ivan Maidanski <ivmai@mail.ru>
authorivmai <ivmai>
Sat, 19 Sep 2009 18:20:26 +0000 (18:20 +0000)
committerIvan Maidanski <ivmai@mail.ru>
Tue, 26 Jul 2011 17:06:47 +0000 (21:06 +0400)
(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.

ChangeLog
dbg_mlc.c
include/gc.h
include/private/gc_priv.h

index 8335a5ecaa81c3bb6eaee95f4b520c9ac1e1120e..be635604db07d3454f497a370be671f951bc55e4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+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)
 
index 2211a5dc6ba33d06873514f103d9ffd38f1bce85..e57981e3f0cbeeb159ecf2cd8397022a9ef3c5ac 100644 (file)
--- a/dbg_mlc.c
+++ b/dbg_mlc.c
@@ -235,7 +235,11 @@ GC_bool GC_has_other_debug_info(ptr_t p)
 
   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();
   }
 
index 3a83f30a7f1871c808d66eed0a1270c5dbe51b4d..666fd237727d7f1c9a9e1592ce831f7cc1f07993 100644 (file)
@@ -478,7 +478,8 @@ GC_API void GC_CALL GC_gcollect(void);
 /* 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 */);
 
index 03010c485efee6c658e25f12eb48f1ab13003452..bbc5f2c65548e2173308749e20b1e89be6a222aa 100644 (file)
@@ -1690,8 +1690,8 @@ ptr_t GC_reclaim_generic(struct hblk * hbp, hdr *hhdr, size_t sz,
                                 /* 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   */