MacOS-X compatibility fix for GC

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@27845 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
rfm 2009-02-11 10:11:33 +00:00
parent 814e9c50c7
commit d7c2ea71f7
4 changed files with 12 additions and 12 deletions

View file

@ -2,6 +2,11 @@
* Source/NSNotificationCenter.m: Fix bug removing observations for
collected observers.
* Headers/Foundation/NSGarbageCollector.h:
* Source/NSGarbageCollector.m:
* Source/NSObject.m:
Update the behavior of the -zone method to match MacOS-X 10.5 and
always return the default zone when used with GC.
2009-02-10 Richard Frith-Macdonald <rfm@gnu.org>

View file

@ -88,10 +88,10 @@ extern "C" {
- (BOOL) isEnabled;
/** Returns a zone for holding non-collectable pointers.<br />
* Memory allocated in this zone will be seen by the garbage collector and
* collected (so it doesn't need to be freed explicitly), but the presence
* of pointers from the memory to other objectrs will not prevent those
* other objects from being collected.
* Memory allocated in this zone will not be seen by the garbage collector
* and will never be collected (so it needs to be freed explicitly).
* The presence of pointers from the memory to other objects will not
* prevent those other objects from being collected.
*/
- (NSZone*) zone;
@end

View file

@ -148,7 +148,7 @@ static NSHashTable *uncollectable = 0;
- (NSZone*) zone
{
return GSAtomicMallocZone();
return NSDefaultMallocZone();
}
@end

View file

@ -668,14 +668,9 @@ NSIncrementExtraRefCount(id anObject)
inline NSZone *
GSObjCZone(NSObject *object)
{
/* If we have GC enabled, all objects are garbage collected and memory
* they allocate should generally be garbage collectable but not scanned
* for pointers.
* If an object wants to have memory which IS scanned for pointers by the
* garbage collector, it should use NSAllocateCollectable() to get it,
* rather than using the old zone based memory allocation.
/* MacOS-X 10.5 seems to return the default malloc zone if GC is enabled.
*/
return GSAtomicMallocZone();
return NSDefaultMallocZone();
}
static void