mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 08:21:25 +00:00
More GC updates
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@4958 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
18f87db0c7
commit
78e6f68250
5 changed files with 125 additions and 2 deletions
|
@ -272,6 +272,9 @@ NSExtraRefCount (id anObject)
|
|||
*/
|
||||
#if GS_WITH_GC
|
||||
|
||||
#include <gc.h>
|
||||
#include <gc_typed.h>
|
||||
|
||||
inline NSZone *
|
||||
fastZone(NSObject *object)
|
||||
{
|
||||
|
@ -294,8 +297,26 @@ NSAllocateObject(Class aClass, unsigned extraBytes, NSZone *zone)
|
|||
id new = nil;
|
||||
int size = aClass->instance_size + extraBytes;
|
||||
|
||||
if (CLS_ISCLASS(aClass))
|
||||
new = NSZoneMalloc(zone, size);
|
||||
NSCAssert((CLS_ISCLASS(aClass)), @"Bad class for new object");
|
||||
if (zone == GSAtomicMallocZone())
|
||||
{
|
||||
new = NSZoneMalloc(zone, size);
|
||||
}
|
||||
else
|
||||
{
|
||||
GC_descr gc_type = aClass->gc_object_type;
|
||||
|
||||
if (gc_type == 0)
|
||||
{
|
||||
new = NSZoneMalloc(zone, size);
|
||||
NSLog(@"No garbage collection information for '%s'", aClass->name);
|
||||
}
|
||||
else
|
||||
{
|
||||
new = GC_CALLOC_EXPLICTLY_TYPED(1, size, gc_type);
|
||||
}
|
||||
}
|
||||
|
||||
if (new != nil)
|
||||
{
|
||||
memset(new, 0, size);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue