summaryrefslogtreecommitdiffstats
path: root/gc.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2015-11-16 20:13:22 -0800
committerKaz Kylheku <kaz@kylheku.com>2015-11-20 16:17:18 -0800
commitd89b907d2dc260bee706f787e05f55344b61785e (patch)
treeb96a139f233aca356e7dbb4fc15da484cc854baf /gc.c
parentbc85ec12271ecc273cb36e7ef35d071c364e46ab (diff)
downloadtxr-d89b907d2dc260bee706f787e05f55344b61785e.tar.gz
txr-d89b907d2dc260bee706f787e05f55344b61785e.tar.bz2
txr-d89b907d2dc260bee706f787e05f55344b61785e.zip
Useful debugging function for spurious retention.
* gc.c (gc_report_copies): New function * gc.h (gc_report_copies): Declared.
Diffstat (limited to 'gc.c')
-rw-r--r--gc.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/gc.c b/gc.c
index 58f0790c..fdc32195 100644
--- a/gc.c
+++ b/gc.c
@@ -918,3 +918,15 @@ void gc_hint_func(val *val)
{
(void) val;
}
+
+void gc_report_copies(val *pvar)
+{
+ val *opvar = pvar;
+ val obj = *pvar++;
+
+ for (; pvar < gc_stack_bottom; pvar++) {
+ if (*pvar == obj)
+ printf("%p found at %p (offset %d)\n",
+ (void *) obj, (void *) pvar, (int) (pvar - opvar));
+ }
+}