GC tweaks

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@28063 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2009-03-10 17:12:47 +00:00
parent 8afbc2fcb7
commit d2e2eda24c
2 changed files with 25 additions and 0 deletions

View file

@ -811,6 +811,18 @@ GSDescriptionForClassMethod(pcl self, SEL aSel)
}
}
#if GS_WITH_GC
/* Function to turn Boehm GC warnings into NSLog warnings.
*/
static void
warn_proc(char *msg, GC_word arg)
{
char buf[strlen(msg)+1024];
sprintf(buf, msg, (unsigned long)arg);
NSLog(@"Garbage collector: %s", buf);
}
#endif
/**
* This message is sent to a class once just before it is used for the first
* time. If class has a superclass, its implementation of +initialize is
@ -827,6 +839,7 @@ GSDescriptionForClassMethod(pcl self, SEL aSel)
* This is not necessary on most platforms, but is good practice.
*/
GC_init();
GC_set_warn_proc(warn_proc);
#endif
#ifdef __MINGW32__