From 0807ecd3d6cbbe2d59b9fd584869cb3d5f727c42 Mon Sep 17 00:00:00 2001 From: rfm Date: Tue, 24 Mar 2009 11:12:25 +0000 Subject: [PATCH] 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 --- ChangeLog | 2 ++ Source/NSZone.m | 8 ++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0eb4bca76..77a03efe9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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 diff --git a/Source/NSZone.m b/Source/NSZone.m index 13732f298..d71bda6e5 100644 --- a/Source/NSZone.m +++ b/Source/NSZone.m @@ -1753,6 +1753,10 @@ NSReallocateCollectable(void *ptr, NSUInteger size, NSUInteger options) } #else +#if defined(DEBUG) +#define GC_DEBUG 1 +#endif + #include /* @@ -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); } }