+2008-09-10 Hans Boehm <Hans.Boehm@hp.com>
+ * dbg_mlc.c (GC_print_smashed_obj): Increase robustness with
+ smashed string, (GC_debug_free_inner): Mark as free.
+ * mallocx.c (GC_malloc_many): Always clear new block if
+ GC_debugging_started.
+ * reclaim.c: Move GC_debugging_started from
+ GC_reclaim_small_nonempty_block() to GC_reclaim_generic(),
+ which is also called directly.
+ * doc/README: Fix spelling error. Update license summary.
+ * include/gc.h (GC_PRE_INCR3, GC_POST_INCR3): add (void **) casts.
+ * tests/test.c: Don't define GC_DEBUG if already defined.
+
2008-08-27 Hans Boehm <Hans.Boehm@hp.com>
* doc/simple_example.html: update --enable-full-debug reference,
Make HTML formatting standards compliant.
GC_err_printf("<smashed>, appr. sz = %ld)\n",
(GC_size((ptr_t)ohdr) - DEBUG_BYTES));
} else {
- if (ohdr -> oh_string[0] == '\0') {
+ if ((word)(ohdr -> oh_string) < HBLKSIZE) {
+ GC_err_puts("(smashed string)");
+ } else if (ohdr -> oh_string[0] == '\0') {
GC_err_puts("EMPTY(smashed?)");
} else {
GC_err_puts(ohdr -> oh_string);
/* Used internally; we assume it's called correctly. */
void GC_debug_free_inner(void * p)
{
- GC_free_inner(GC_base(p));
+ ptr_t base = GC_base(p);
+ GC_ASSERT((ptr_t)p - (ptr_t)base == sizeof(oh));
+ /* Invalidate size */
+ ((oh *)base) -> oh_sz = GC_size(base);
+ GC_free_inner(base);
}
#endif
A few of the files needed to use the GNU-style build procedure come with
slightly different licenses, though they are all similar in spirit. A few
are GPL'ed, but with an exception that should cover all uses in the
-collector. (If you are concerned about such things, I recommend you look
+collector. (If you are concerned about such things, I recommend you look
at the notice in config.guess or ltmain.sh.)
+The atomic_ops library contains some code that is covered by the GNU General
+Public License, but is not needed by, nor linked into the collector library.
+It is included here only becuase the atomic_ops distribution is, for
+simplicity, included in its entirety.
+
This is version 7.2alpha1 of a conservative garbage collector for C and C++.
You might find a more recent version of this at
# define GC_PTR_ADD3(x, n, type_of_result) \
((type_of_result)GC_same_obj((x)+(n), (x)))
# define GC_PRE_INCR3(x, n, type_of_result) \
- ((type_of_result)GC_pre_incr(&(x), (n)*sizeof(*x)))
+ ((type_of_result)GC_pre_incr((void **)(&(x)), (n)*sizeof(*x)))
# define GC_POST_INCR3(x, n, type_of_result) \
- ((type_of_result)GC_post_incr(&(x), (n)*sizeof(*x)))
+ ((type_of_result)GC_post_incr((void **)(&(x)), (n)*sizeof(*x)))
# define GC_PTR_ADD(x, n) \
GC_PTR_ADD3(x, n, typeof(x))
# define GC_PRE_INCR(x, n) \
GC_release_mark_lock();
# endif
- op = GC_build_fl(h, lw, ok -> ok_init, 0);
+ op = GC_build_fl(h, lw, (ok -> ok_init || GC_debugging_started), 0);
# ifdef PARALLEL_MARK
*result = op;
GC_acquire_mark_lock();
GC_ASSERT(GC_find_header((ptr_t)hbp) == hhdr);
GC_remove_protection(hbp, 1, (hhdr)->hb_descr == 0 /* Pointer-free? */);
- if (init) {
+ if (init || GC_debugging_started) {
result = GC_reclaim_clear(hbp, hhdr, sz, list, count);
} else {
GC_ASSERT((hhdr)->hb_descr == 0 /* Pointer-free block */);
GC_reclaim_check(hbp, hhdr, sz);
} else {
*flh = GC_reclaim_generic(hbp, hhdr, sz,
- (ok -> ok_init || GC_debugging_started),
+ ok -> ok_init,
*flh, &GC_bytes_found);
}
}
# undef GC_BUILD
-#if defined(DBG_HDRS_ALL) || defined(MAKE_BACK_GRAPH)
+#if (defined(DBG_HDRS_ALL) || defined(MAKE_BACK_GRAPH)) && !defined(GC_DEBUG)
# define GC_DEBUG
#endif