From 4136ad8413726f4d82efeb6d09c4fcdb23bd5047 Mon Sep 17 00:00:00 2001 From: theraven Date: Fri, 27 May 2011 18:06:39 +0000 Subject: [PATCH] Do an exhaustive collection before dumping stats in response to a signal. --- gc_boehm.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/gc_boehm.c b/gc_boehm.c index ff12ea2..1233237 100644 --- a/gc_boehm.c +++ b/gc_boehm.c @@ -1,4 +1,3 @@ -//#define GC_DEBUG #define GNUSTEP_LIBOBJC_NO_LEGACY #include "objc/runtime.h" #include "class.h" @@ -468,6 +467,11 @@ void* objc_gc_reallocate_collectable(void *ptr, size_t size, BOOL isScanned) return new; } +static void collectAndDumpStats(int signalNo) +{ + objc_collect(OBJC_EXHAUSTIVE_COLLECTION); + GC_dump(); +} static void init(void) @@ -482,7 +486,7 @@ static void init(void) if ((sigNumber = getenv("LIBOBJC_DUMP_GC_STATUS_ON_SIGNAL"))) { int s = sigNumber[0] ? (int)strtol(sigNumber, NULL, 10) : SIGUSR2; - signal(s, (void(*)(int))GC_dump); + signal(s, collectAndDumpStats); } refcounts = refcount_create(4096); GC_clear_roots();