tweak GC for improved performance and debugging

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@28129 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2009-03-24 11:12:25 +00:00
parent 057818ab06
commit 3e5de3081a
2 changed files with 8 additions and 2 deletions

View file

@ -4,6 +4,8 @@
* Source/GSSocketStream.m:
Avoid unnecessary memory allocation.
Use weak pointers to break finalisation cycles.
* Source/NSZone.m: Use GC debug unless built with 'debug=no'
Allocate memory ignoring pointers into the allocated data.
2009-03-21 Richard Frith-Macdonald <rfm@gnu.org>

View file

@ -1753,6 +1753,10 @@ NSReallocateCollectable(void *ptr, NSUInteger size, NSUInteger options)
}
#else
#if defined(DEBUG)
#define GC_DEBUG 1
#endif
#include <gc.h>
/*
@ -1784,7 +1788,7 @@ NSAllocateCollectable(NSUInteger size, NSUInteger options)
}
else
{
ptr = (void*)GC_MALLOC(size);
ptr = (void*)GC_MALLOC_IGNORE_OFF_PAGE(size);
memset(ptr, '\0', size);
}
}
@ -1796,7 +1800,7 @@ NSAllocateCollectable(NSUInteger size, NSUInteger options)
}
else
{
ptr = (void*)GC_MALLOC_ATOMIC(size);
ptr = (void*)GC_MALLOC_ATOMIC_IGNORE_OFF_PAGE(size);
memset(ptr, '\0', size);
}
}