]> granicus.if.org Git - gc/commitdiff
2010-03-26 Ivan Maidanski <ivmai@mail.ru> (really Hans Boehm)
authorivmai <ivmai>
Fri, 26 Mar 2010 07:22:57 +0000 (07:22 +0000)
committerIvan Maidanski <ivmai@mail.ru>
Tue, 26 Jul 2011 17:06:53 +0000 (21:06 +0400)
* alloc.c (GC_maybe_gc): Move GC_notify_full_gc() call upper to
be just before GC_clear_marks() call.
* include/gc_mark.h (GC_start_callback_proc): Refine the comment.

ChangeLog
alloc.c
include/gc_mark.h

index 223b8ed24efa085dca3e3a654c278cb4629ebde2..b43001df6e37d5d6d0ca8fdb0254f6bf75e2822e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2010-03-26  Ivan Maidanski <ivmai@mail.ru> (really Hans Boehm)
+
+       * alloc.c (GC_maybe_gc): Move GC_notify_full_gc() call upper to
+       be just before GC_clear_marks() call.
+       * include/gc_mark.h (GC_start_callback_proc): Refine the comment.
+
 2010-03-23  Ivan Maidanski <ivmai@mail.ru> (really Dave Korn)
 
        * Makefile.am (check_LTLIBRARIES): Initialise to empty.
diff --git a/alloc.c b/alloc.c
index 78011a46694abf40c4c1432d31a65297c8bc540c..1b26d43d01c7ae290460f732fd05689d9e8faae4 100644 (file)
--- a/alloc.c
+++ b/alloc.c
@@ -369,9 +369,9 @@ STATIC void GC_maybe_gc(void)
             }
             GC_promote_black_lists();
             (void)GC_reclaim_all((GC_stop_func)0, TRUE);
+            GC_notify_full_gc();
             GC_clear_marks();
             n_partial_gcs = 0;
-            GC_notify_full_gc();
             GC_is_full_gc = TRUE;
           } else {
             n_partial_gcs++;
index 420e47023397e27dca32b18caf220558b3836aa4..3c35ced24fc35ac71713f2a4419830b821d3ae18 100644 (file)
@@ -213,7 +213,12 @@ GC_API size_t GC_CALL GC_get_free_bytes_inner(void);
 
 /* Set and get the client notifier on collections.  The client function */
 /* is called at the start of every full GC (called with the allocation  */
-/* lock held).  May be 0.                                               */
+/* lock held).  May be 0.  This is a really tricky interface to use     */
+/* correctly.  Unless you really understand the collector internals,    */
+/* the callback should not, directly or indirectly, make any GC_ or     */
+/* potentially blocking calls.  In particular, it is not safe to        */
+/* allocate memory using the garbage collector from within the callback */
+/* function.                                                            */
 typedef void (GC_CALLBACK * GC_start_callback_proc)(void);
 GC_API void GC_CALL GC_set_start_callback(GC_start_callback_proc);
 GC_API GC_start_callback_proc GC_CALL GC_get_start_callback(void);