1 The following patch has to be applied to Boehm gc6.0 from
2 http://www.hpl.hp.com/personal/Hans_Boehm/gc/
3 and you need to configure ircd with --with-leak-detect=path-to-gc6.0/.lib/
5 diff -ru -x *.a -x *.so* -x *.o -x *.lo -x *.log -x *.*~ gc6.0/include/gc.h gc6.0-ircu/include/gc.h
6 --- gc6.0/include/gc.h Tue Jul 24 05:02:02 2001
7 +++ gc6.0-ircu/include/gc.h Sat Jun 29 21:04:40 2002
9 GC_API GC_PTR GC_call_with_alloc_lock
10 GC_PROTO((GC_fn_type fn, GC_PTR client_data));
12 +GC_API GC_warn_proc GC_set_warn_proc GC_PROTO((GC_warn_proc p));
14 +/* Sets the leak handler to be called when an object is leaked. */
15 +GC_API void GC_set_leak_handler(void (*lh)(void*, int));
17 /* The following routines are primarily intended for use with a */
18 /* preprocessor which inserts calls to check C pointer arithmetic. */
20 diff -ru -x *.a -x *.so* -x *.o -x *.lo -x *.log -x *.*~ gc6.0/reclaim.c gc6.0-ircu/reclaim.c
21 --- gc6.0/reclaim.c Tue Jun 12 10:21:28 2001
22 +++ gc6.0-ircu/reclaim.c Sat Jun 29 21:00:16 2002
25 #endif /* PARALLEL_MARK */
27 -static void report_leak(p, sz)
30 +void (*leak_handler)(void*, int);
33 +GC_set_leak_handler(void (*lh)(void*, int))
39 +report_leak(ptr_t p, word sz)
41 - if (HDR(p) -> hb_obj_kind == PTRFREE) {
42 - GC_err_printf0("Leaked atomic object at ");
44 - GC_err_printf0("Leaked composite object at ");
46 - GC_print_heap_obj(p);
47 - GC_err_printf0("\n");
48 + if (leak_handler != NULL)
49 + leak_handler((void*)p, (int)sz);
52 -# define FOUND_FREE(hblk, word_no) \
54 - report_leak((ptr_t)hblk + WORDS_TO_BYTES(word_no), \
55 - HDR(hblk) -> hb_sz); \
57 +#define FOUND_FREE(hblk, word_no) \
58 + report_leak((ptr_t)hblk + WORDS_TO_BYTES(word_no), HDR(hblk)->hb_sz);