X-Git-Url: http://git.pk910.de/?p=ircu2.10.12-pk.git;a=blobdiff_plain;f=doc%2Fdebug_memleak_gc.patch;fp=doc%2Fdebug_memleak_gc.patch;h=aeae12864664f1cae161724daa015439669771d4;hp=0000000000000000000000000000000000000000;hb=0400a5a6479398d82526785c18c0df8bc8b92dce;hpb=d17e10da972ce5776c60b4c317267c6abe0e1ead diff --git a/doc/debug_memleak_gc.patch b/doc/debug_memleak_gc.patch new file mode 100644 index 0000000..aeae128 --- /dev/null +++ b/doc/debug_memleak_gc.patch @@ -0,0 +1,54 @@ +diff -rbud gc6.5/include/gc.h gc6.5.patched/include/gc.h +--- gc6.5/include/gc.h Sat May 21 05:50:58 2005 ++++ gc6.5.patched/include/gc.h Sat Jun 25 00:11:18 2005 +@@ -779,6 +779,11 @@ + GC_API GC_PTR GC_call_with_alloc_lock + GC_PROTO((GC_fn_type fn, GC_PTR client_data)); + ++GC_API GC_warn_proc GC_set_warn_proc GC_PROTO((GC_warn_proc p)); ++ ++/* Sets the leak handler to be called when an object is leaked. */ ++GC_API void GC_set_leak_handler(void (*lh)(void*, int)); ++ + /* The following routines are primarily intended for use with a */ + /* preprocessor which inserts calls to check C pointer arithmetic. */ + /* They indicate failure by invoking the corresponding _print_proc. */ +diff -rbud gc6.5/reclaim.c gc6.5.patched/reclaim.c +--- gc6.5/reclaim.c Tue Nov 23 06:58:18 2004 ++++ gc6.5.patched/reclaim.c Sat Jun 25 00:52:18 2005 +@@ -36,6 +36,14 @@ + + GC_bool GC_have_errors = FALSE; + ++static void (*leak_handler)(void*, int); ++ ++void ++GC_set_leak_handler(void (*lh)(void*, int)) ++{ ++ leak_handler = lh; ++} ++ + void GC_add_leaked(leaked) + ptr_t leaked; + { +@@ -64,6 +72,12 @@ + if (GC_debugging_started) GC_print_all_smashed(); + for (i = 0; i < GC_n_leaked; ++i) { + ptr_t p = GC_leaked[i]; ++ if (leak_handler) ++ { ++ leak_handler(GC_base(p), GC_size(GC_base(p))); ++ } ++ else ++ { + if (HDR(p) -> hb_obj_kind == PTRFREE) { + GC_err_printf0("Leaked atomic object at "); + } else { +@@ -71,6 +85,7 @@ + } + GC_print_heap_obj(p); + GC_err_printf0("\n"); ++ } + GC_free(p); + GC_leaked[i] = 0; + }